1 /*===---- altivec.h - Standard header for type generic math ---------------===*\ 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 \*===----------------------------------------------------------------------===*/ 8 9 #ifndef __ALTIVEC_H 10 #define __ALTIVEC_H 11 12 #ifndef __ALTIVEC__ 13 #error "AltiVec support not enabled" 14 #endif 15 16 /* Constants for mapping CR6 bits to predicate result. */ 17 18 #define __CR6_EQ 0 19 #define __CR6_EQ_REV 1 20 #define __CR6_LT 2 21 #define __CR6_LT_REV 3 22 23 /* Constants for vec_test_data_class */ 24 #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0) 25 #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1) 26 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \ 27 __VEC_CLASS_FP_SUBNORMAL_N) 28 #define __VEC_CLASS_FP_ZERO_N (1<<2) 29 #define __VEC_CLASS_FP_ZERO_P (1<<3) 30 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \ 31 __VEC_CLASS_FP_ZERO_N) 32 #define __VEC_CLASS_FP_INFINITY_N (1<<4) 33 #define __VEC_CLASS_FP_INFINITY_P (1<<5) 34 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \ 35 __VEC_CLASS_FP_INFINITY_N) 36 #define __VEC_CLASS_FP_NAN (1<<6) 37 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \ 38 __VEC_CLASS_FP_SUBNORMAL | \ 39 __VEC_CLASS_FP_ZERO | \ 40 __VEC_CLASS_FP_INFINITY) 41 42 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) 43 44 #include <stddef.h> 45 46 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 47 vector signed char __a, vector signed char __b, vector unsigned char __c); 48 49 static __inline__ vector unsigned char __ATTRS_o_ai 50 vec_perm(vector unsigned char __a, vector unsigned char __b, 51 vector unsigned char __c); 52 53 static __inline__ vector bool char __ATTRS_o_ai 54 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); 55 56 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 57 vector signed short __b, 58 vector unsigned char __c); 59 60 static __inline__ vector unsigned short __ATTRS_o_ai 61 vec_perm(vector unsigned short __a, vector unsigned short __b, 62 vector unsigned char __c); 63 64 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 65 vector bool short __a, vector bool short __b, vector unsigned char __c); 66 67 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 68 vector pixel __b, 69 vector unsigned char __c); 70 71 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 72 vector signed int __b, 73 vector unsigned char __c); 74 75 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( 76 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); 77 78 static __inline__ vector bool int __ATTRS_o_ai 79 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); 80 81 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 82 vector float __b, 83 vector unsigned char __c); 84 85 #ifdef __VSX__ 86 static __inline__ vector long long __ATTRS_o_ai 87 vec_perm(vector signed long long __a, vector signed long long __b, 88 vector unsigned char __c); 89 90 static __inline__ vector unsigned long long __ATTRS_o_ai 91 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 92 vector unsigned char __c); 93 94 static __inline__ vector bool long long __ATTRS_o_ai 95 vec_perm(vector bool long long __a, vector bool long long __b, 96 vector unsigned char __c); 97 98 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, 99 vector double __b, 100 vector unsigned char __c); 101 #endif 102 103 static __inline__ vector unsigned char __ATTRS_o_ai 104 vec_xor(vector unsigned char __a, vector unsigned char __b); 105 106 /* vec_abs */ 107 108 #define __builtin_altivec_abs_v16qi vec_abs 109 #define __builtin_altivec_abs_v8hi vec_abs 110 #define __builtin_altivec_abs_v4si vec_abs 111 112 static __inline__ vector signed char __ATTRS_o_ai 113 vec_abs(vector signed char __a) { 114 return __builtin_altivec_vmaxsb(__a, -__a); 115 } 116 117 static __inline__ vector signed short __ATTRS_o_ai 118 vec_abs(vector signed short __a) { 119 return __builtin_altivec_vmaxsh(__a, -__a); 120 } 121 122 static __inline__ vector signed int __ATTRS_o_ai 123 vec_abs(vector signed int __a) { 124 return __builtin_altivec_vmaxsw(__a, -__a); 125 } 126 127 #ifdef __POWER8_VECTOR__ 128 static __inline__ vector signed long long __ATTRS_o_ai 129 vec_abs(vector signed long long __a) { 130 return __builtin_altivec_vmaxsd(__a, -__a); 131 } 132 #endif 133 134 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { 135 #ifdef __VSX__ 136 return __builtin_vsx_xvabssp(__a); 137 #else 138 vector unsigned int __res = 139 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); 140 return (vector float)__res; 141 #endif 142 } 143 144 #ifdef __VSX__ 145 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { 146 return __builtin_vsx_xvabsdp(__a); 147 } 148 #endif 149 150 /* vec_abss */ 151 #define __builtin_altivec_abss_v16qi vec_abss 152 #define __builtin_altivec_abss_v8hi vec_abss 153 #define __builtin_altivec_abss_v4si vec_abss 154 155 static __inline__ vector signed char __ATTRS_o_ai 156 vec_abss(vector signed char __a) { 157 return __builtin_altivec_vmaxsb( 158 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); 159 } 160 161 static __inline__ vector signed short __ATTRS_o_ai 162 vec_abss(vector signed short __a) { 163 return __builtin_altivec_vmaxsh( 164 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); 165 } 166 167 static __inline__ vector signed int __ATTRS_o_ai 168 vec_abss(vector signed int __a) { 169 return __builtin_altivec_vmaxsw( 170 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); 171 } 172 173 /* vec_absd */ 174 #if defined(__POWER9_VECTOR__) 175 176 static __inline__ vector unsigned char __ATTRS_o_ai 177 vec_absd(vector unsigned char __a, vector unsigned char __b) { 178 return __builtin_altivec_vabsdub(__a, __b); 179 } 180 181 static __inline__ vector unsigned short __ATTRS_o_ai 182 vec_absd(vector unsigned short __a, vector unsigned short __b) { 183 return __builtin_altivec_vabsduh(__a, __b); 184 } 185 186 static __inline__ vector unsigned int __ATTRS_o_ai 187 vec_absd(vector unsigned int __a, vector unsigned int __b) { 188 return __builtin_altivec_vabsduw(__a, __b); 189 } 190 191 #endif /* End __POWER9_VECTOR__ */ 192 193 /* vec_add */ 194 195 static __inline__ vector signed char __ATTRS_o_ai 196 vec_add(vector signed char __a, vector signed char __b) { 197 return __a + __b; 198 } 199 200 static __inline__ vector signed char __ATTRS_o_ai 201 vec_add(vector bool char __a, vector signed char __b) { 202 return (vector signed char)__a + __b; 203 } 204 205 static __inline__ vector signed char __ATTRS_o_ai 206 vec_add(vector signed char __a, vector bool char __b) { 207 return __a + (vector signed char)__b; 208 } 209 210 static __inline__ vector unsigned char __ATTRS_o_ai 211 vec_add(vector unsigned char __a, vector unsigned char __b) { 212 return __a + __b; 213 } 214 215 static __inline__ vector unsigned char __ATTRS_o_ai 216 vec_add(vector bool char __a, vector unsigned char __b) { 217 return (vector unsigned char)__a + __b; 218 } 219 220 static __inline__ vector unsigned char __ATTRS_o_ai 221 vec_add(vector unsigned char __a, vector bool char __b) { 222 return __a + (vector unsigned char)__b; 223 } 224 225 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 226 vector short __b) { 227 return __a + __b; 228 } 229 230 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, 231 vector short __b) { 232 return (vector short)__a + __b; 233 } 234 235 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 236 vector bool short __b) { 237 return __a + (vector short)__b; 238 } 239 240 static __inline__ vector unsigned short __ATTRS_o_ai 241 vec_add(vector unsigned short __a, vector unsigned short __b) { 242 return __a + __b; 243 } 244 245 static __inline__ vector unsigned short __ATTRS_o_ai 246 vec_add(vector bool short __a, vector unsigned short __b) { 247 return (vector unsigned short)__a + __b; 248 } 249 250 static __inline__ vector unsigned short __ATTRS_o_ai 251 vec_add(vector unsigned short __a, vector bool short __b) { 252 return __a + (vector unsigned short)__b; 253 } 254 255 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 256 vector int __b) { 257 return __a + __b; 258 } 259 260 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, 261 vector int __b) { 262 return (vector int)__a + __b; 263 } 264 265 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 266 vector bool int __b) { 267 return __a + (vector int)__b; 268 } 269 270 static __inline__ vector unsigned int __ATTRS_o_ai 271 vec_add(vector unsigned int __a, vector unsigned int __b) { 272 return __a + __b; 273 } 274 275 static __inline__ vector unsigned int __ATTRS_o_ai 276 vec_add(vector bool int __a, vector unsigned int __b) { 277 return (vector unsigned int)__a + __b; 278 } 279 280 static __inline__ vector unsigned int __ATTRS_o_ai 281 vec_add(vector unsigned int __a, vector bool int __b) { 282 return __a + (vector unsigned int)__b; 283 } 284 285 #ifdef __POWER8_VECTOR__ 286 static __inline__ vector signed long long __ATTRS_o_ai 287 vec_add(vector signed long long __a, vector signed long long __b) { 288 return __a + __b; 289 } 290 291 static __inline__ vector unsigned long long __ATTRS_o_ai 292 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 293 return __a + __b; 294 } 295 296 #ifdef __SIZEOF_INT128__ 297 static __inline__ vector signed __int128 __ATTRS_o_ai 298 vec_add(vector signed __int128 __a, vector signed __int128 __b) { 299 return __a + __b; 300 } 301 302 static __inline__ vector unsigned __int128 __ATTRS_o_ai 303 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { 304 return __a + __b; 305 } 306 #endif 307 308 static __inline__ vector unsigned char __attribute__((__always_inline__)) 309 vec_add_u128(vector unsigned char __a, vector unsigned char __b) { 310 return __builtin_altivec_vadduqm(__a, __b); 311 } 312 #elif defined(__VSX__) 313 static __inline__ vector signed long long __ATTRS_o_ai 314 vec_add(vector signed long long __a, vector signed long long __b) { 315 #ifdef __LITTLE_ENDIAN__ 316 // Little endian systems on CPU's prior to Power8 don't really exist 317 // so scalarizing is fine. 318 return __a + __b; 319 #else 320 vector unsigned int __res = 321 (vector unsigned int)__a + (vector unsigned int)__b; 322 vector unsigned int __carry = __builtin_altivec_vaddcuw( 323 (vector unsigned int)__a, (vector unsigned int)__b); 324 __carry = __builtin_shufflevector((vector unsigned char)__carry, 325 (vector unsigned char)__carry, 0, 0, 0, 7, 326 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0); 327 return (vector signed long long)(__res + __carry); 328 #endif 329 } 330 331 static __inline__ vector unsigned long long __ATTRS_o_ai 332 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 333 return (vector unsigned long long)vec_add((vector signed long long)__a, 334 (vector signed long long)__b); 335 } 336 #endif // __POWER8_VECTOR__ 337 338 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 339 vector float __b) { 340 return __a + __b; 341 } 342 343 #ifdef __VSX__ 344 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 345 vector double __b) { 346 return __a + __b; 347 } 348 #endif // __VSX__ 349 350 /* vec_adde */ 351 352 #ifdef __POWER8_VECTOR__ 353 #ifdef __SIZEOF_INT128__ 354 static __inline__ vector signed __int128 __ATTRS_o_ai 355 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 356 vector signed __int128 __c) { 357 return __builtin_altivec_vaddeuqm(__a, __b, __c); 358 } 359 360 static __inline__ vector unsigned __int128 __ATTRS_o_ai 361 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 362 vector unsigned __int128 __c) { 363 return __builtin_altivec_vaddeuqm(__a, __b, __c); 364 } 365 #endif 366 367 static __inline__ vector unsigned char __attribute__((__always_inline__)) 368 vec_adde_u128(vector unsigned char __a, vector unsigned char __b, 369 vector unsigned char __c) { 370 return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c); 371 } 372 #endif 373 374 static __inline__ vector signed int __ATTRS_o_ai 375 vec_adde(vector signed int __a, vector signed int __b, 376 vector signed int __c) { 377 vector signed int __mask = {1, 1, 1, 1}; 378 vector signed int __carry = __c & __mask; 379 return vec_add(vec_add(__a, __b), __carry); 380 } 381 382 static __inline__ vector unsigned int __ATTRS_o_ai 383 vec_adde(vector unsigned int __a, vector unsigned int __b, 384 vector unsigned int __c) { 385 vector unsigned int __mask = {1, 1, 1, 1}; 386 vector unsigned int __carry = __c & __mask; 387 return vec_add(vec_add(__a, __b), __carry); 388 } 389 390 /* vec_addec */ 391 392 #ifdef __POWER8_VECTOR__ 393 #ifdef __SIZEOF_INT128__ 394 static __inline__ vector signed __int128 __ATTRS_o_ai 395 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 396 vector signed __int128 __c) { 397 return __builtin_altivec_vaddecuq(__a, __b, __c); 398 } 399 400 static __inline__ vector unsigned __int128 __ATTRS_o_ai 401 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 402 vector unsigned __int128 __c) { 403 return __builtin_altivec_vaddecuq(__a, __b, __c); 404 } 405 #endif 406 407 static __inline__ vector unsigned char __attribute__((__always_inline__)) 408 vec_addec_u128(vector unsigned char __a, vector unsigned char __b, 409 vector unsigned char __c) { 410 return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c); 411 } 412 413 #ifdef __powerpc64__ 414 static __inline__ vector signed int __ATTRS_o_ai 415 vec_addec(vector signed int __a, vector signed int __b, 416 vector signed int __c) { 417 418 signed int __result[4]; 419 for (int i = 0; i < 4; i++) { 420 unsigned int __tempa = (unsigned int) __a[i]; 421 unsigned int __tempb = (unsigned int) __b[i]; 422 unsigned int __tempc = (unsigned int) __c[i]; 423 __tempc = __tempc & 0x00000001; 424 unsigned long long __longa = (unsigned long long) __tempa; 425 unsigned long long __longb = (unsigned long long) __tempb; 426 unsigned long long __longc = (unsigned long long) __tempc; 427 unsigned long long __sum = __longa + __longb + __longc; 428 unsigned long long __res = (__sum >> 32) & 0x01; 429 unsigned long long __tempres = (unsigned int) __res; 430 __result[i] = (signed int) __tempres; 431 } 432 433 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; 434 return ret; 435 } 436 437 static __inline__ vector unsigned int __ATTRS_o_ai 438 vec_addec(vector unsigned int __a, vector unsigned int __b, 439 vector unsigned int __c) { 440 441 unsigned int __result[4]; 442 for (int i = 0; i < 4; i++) { 443 unsigned int __tempc = __c[i] & 1; 444 unsigned long long __longa = (unsigned long long) __a[i]; 445 unsigned long long __longb = (unsigned long long) __b[i]; 446 unsigned long long __longc = (unsigned long long) __tempc; 447 unsigned long long __sum = __longa + __longb + __longc; 448 unsigned long long __res = (__sum >> 32) & 0x01; 449 unsigned long long __tempres = (unsigned int) __res; 450 __result[i] = (signed int) __tempres; 451 } 452 453 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; 454 return ret; 455 } 456 #endif // __powerpc64__ 457 #endif // __POWER8_VECTOR__ 458 459 /* vec_vaddubm */ 460 461 #define __builtin_altivec_vaddubm vec_vaddubm 462 463 static __inline__ vector signed char __ATTRS_o_ai 464 vec_vaddubm(vector signed char __a, vector signed char __b) { 465 return __a + __b; 466 } 467 468 static __inline__ vector signed char __ATTRS_o_ai 469 vec_vaddubm(vector bool char __a, vector signed char __b) { 470 return (vector signed char)__a + __b; 471 } 472 473 static __inline__ vector signed char __ATTRS_o_ai 474 vec_vaddubm(vector signed char __a, vector bool char __b) { 475 return __a + (vector signed char)__b; 476 } 477 478 static __inline__ vector unsigned char __ATTRS_o_ai 479 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 480 return __a + __b; 481 } 482 483 static __inline__ vector unsigned char __ATTRS_o_ai 484 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 485 return (vector unsigned char)__a + __b; 486 } 487 488 static __inline__ vector unsigned char __ATTRS_o_ai 489 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 490 return __a + (vector unsigned char)__b; 491 } 492 493 /* vec_vadduhm */ 494 495 #define __builtin_altivec_vadduhm vec_vadduhm 496 497 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 498 vector short __b) { 499 return __a + __b; 500 } 501 502 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 503 vector short __b) { 504 return (vector short)__a + __b; 505 } 506 507 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 508 vector bool short __b) { 509 return __a + (vector short)__b; 510 } 511 512 static __inline__ vector unsigned short __ATTRS_o_ai 513 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 514 return __a + __b; 515 } 516 517 static __inline__ vector unsigned short __ATTRS_o_ai 518 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 519 return (vector unsigned short)__a + __b; 520 } 521 522 static __inline__ vector unsigned short __ATTRS_o_ai 523 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 524 return __a + (vector unsigned short)__b; 525 } 526 527 /* vec_vadduwm */ 528 529 #define __builtin_altivec_vadduwm vec_vadduwm 530 531 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 532 vector int __b) { 533 return __a + __b; 534 } 535 536 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 537 vector int __b) { 538 return (vector int)__a + __b; 539 } 540 541 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 542 vector bool int __b) { 543 return __a + (vector int)__b; 544 } 545 546 static __inline__ vector unsigned int __ATTRS_o_ai 547 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 548 return __a + __b; 549 } 550 551 static __inline__ vector unsigned int __ATTRS_o_ai 552 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 553 return (vector unsigned int)__a + __b; 554 } 555 556 static __inline__ vector unsigned int __ATTRS_o_ai 557 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 558 return __a + (vector unsigned int)__b; 559 } 560 561 /* vec_vaddfp */ 562 563 #define __builtin_altivec_vaddfp vec_vaddfp 564 565 static __inline__ vector float __attribute__((__always_inline__)) 566 vec_vaddfp(vector float __a, vector float __b) { 567 return __a + __b; 568 } 569 570 /* vec_addc */ 571 572 static __inline__ vector signed int __ATTRS_o_ai 573 vec_addc(vector signed int __a, vector signed int __b) { 574 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 575 (vector unsigned int)__b); 576 } 577 578 static __inline__ vector unsigned int __ATTRS_o_ai 579 vec_addc(vector unsigned int __a, vector unsigned int __b) { 580 return __builtin_altivec_vaddcuw(__a, __b); 581 } 582 583 #ifdef __POWER8_VECTOR__ 584 #ifdef __SIZEOF_INT128__ 585 static __inline__ vector signed __int128 __ATTRS_o_ai 586 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 587 return (vector signed __int128)__builtin_altivec_vaddcuq( 588 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 589 } 590 591 static __inline__ vector unsigned __int128 __ATTRS_o_ai 592 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 593 return __builtin_altivec_vaddcuq(__a, __b); 594 } 595 #endif 596 597 static __inline__ vector unsigned char __attribute__((__always_inline__)) 598 vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { 599 return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b); 600 } 601 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 602 603 /* vec_vaddcuw */ 604 605 static __inline__ vector unsigned int __attribute__((__always_inline__)) 606 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 607 return __builtin_altivec_vaddcuw(__a, __b); 608 } 609 610 /* vec_adds */ 611 612 static __inline__ vector signed char __ATTRS_o_ai 613 vec_adds(vector signed char __a, vector signed char __b) { 614 return __builtin_altivec_vaddsbs(__a, __b); 615 } 616 617 static __inline__ vector signed char __ATTRS_o_ai 618 vec_adds(vector bool char __a, vector signed char __b) { 619 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 620 } 621 622 static __inline__ vector signed char __ATTRS_o_ai 623 vec_adds(vector signed char __a, vector bool char __b) { 624 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 625 } 626 627 static __inline__ vector unsigned char __ATTRS_o_ai 628 vec_adds(vector unsigned char __a, vector unsigned char __b) { 629 return __builtin_altivec_vaddubs(__a, __b); 630 } 631 632 static __inline__ vector unsigned char __ATTRS_o_ai 633 vec_adds(vector bool char __a, vector unsigned char __b) { 634 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 635 } 636 637 static __inline__ vector unsigned char __ATTRS_o_ai 638 vec_adds(vector unsigned char __a, vector bool char __b) { 639 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 640 } 641 642 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 643 vector short __b) { 644 return __builtin_altivec_vaddshs(__a, __b); 645 } 646 647 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 648 vector short __b) { 649 return __builtin_altivec_vaddshs((vector short)__a, __b); 650 } 651 652 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 653 vector bool short __b) { 654 return __builtin_altivec_vaddshs(__a, (vector short)__b); 655 } 656 657 static __inline__ vector unsigned short __ATTRS_o_ai 658 vec_adds(vector unsigned short __a, vector unsigned short __b) { 659 return __builtin_altivec_vadduhs(__a, __b); 660 } 661 662 static __inline__ vector unsigned short __ATTRS_o_ai 663 vec_adds(vector bool short __a, vector unsigned short __b) { 664 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 665 } 666 667 static __inline__ vector unsigned short __ATTRS_o_ai 668 vec_adds(vector unsigned short __a, vector bool short __b) { 669 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 670 } 671 672 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 673 vector int __b) { 674 return __builtin_altivec_vaddsws(__a, __b); 675 } 676 677 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 678 vector int __b) { 679 return __builtin_altivec_vaddsws((vector int)__a, __b); 680 } 681 682 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 683 vector bool int __b) { 684 return __builtin_altivec_vaddsws(__a, (vector int)__b); 685 } 686 687 static __inline__ vector unsigned int __ATTRS_o_ai 688 vec_adds(vector unsigned int __a, vector unsigned int __b) { 689 return __builtin_altivec_vadduws(__a, __b); 690 } 691 692 static __inline__ vector unsigned int __ATTRS_o_ai 693 vec_adds(vector bool int __a, vector unsigned int __b) { 694 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 695 } 696 697 static __inline__ vector unsigned int __ATTRS_o_ai 698 vec_adds(vector unsigned int __a, vector bool int __b) { 699 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 700 } 701 702 /* vec_vaddsbs */ 703 704 static __inline__ vector signed char __ATTRS_o_ai 705 vec_vaddsbs(vector signed char __a, vector signed char __b) { 706 return __builtin_altivec_vaddsbs(__a, __b); 707 } 708 709 static __inline__ vector signed char __ATTRS_o_ai 710 vec_vaddsbs(vector bool char __a, vector signed char __b) { 711 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 712 } 713 714 static __inline__ vector signed char __ATTRS_o_ai 715 vec_vaddsbs(vector signed char __a, vector bool char __b) { 716 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 717 } 718 719 /* vec_vaddubs */ 720 721 static __inline__ vector unsigned char __ATTRS_o_ai 722 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 723 return __builtin_altivec_vaddubs(__a, __b); 724 } 725 726 static __inline__ vector unsigned char __ATTRS_o_ai 727 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 728 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 729 } 730 731 static __inline__ vector unsigned char __ATTRS_o_ai 732 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 733 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 734 } 735 736 /* vec_vaddshs */ 737 738 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 739 vector short __b) { 740 return __builtin_altivec_vaddshs(__a, __b); 741 } 742 743 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 744 vector short __b) { 745 return __builtin_altivec_vaddshs((vector short)__a, __b); 746 } 747 748 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 749 vector bool short __b) { 750 return __builtin_altivec_vaddshs(__a, (vector short)__b); 751 } 752 753 /* vec_vadduhs */ 754 755 static __inline__ vector unsigned short __ATTRS_o_ai 756 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 757 return __builtin_altivec_vadduhs(__a, __b); 758 } 759 760 static __inline__ vector unsigned short __ATTRS_o_ai 761 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 762 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 763 } 764 765 static __inline__ vector unsigned short __ATTRS_o_ai 766 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 767 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 768 } 769 770 /* vec_vaddsws */ 771 772 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 773 vector int __b) { 774 return __builtin_altivec_vaddsws(__a, __b); 775 } 776 777 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 778 vector int __b) { 779 return __builtin_altivec_vaddsws((vector int)__a, __b); 780 } 781 782 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 783 vector bool int __b) { 784 return __builtin_altivec_vaddsws(__a, (vector int)__b); 785 } 786 787 /* vec_vadduws */ 788 789 static __inline__ vector unsigned int __ATTRS_o_ai 790 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 791 return __builtin_altivec_vadduws(__a, __b); 792 } 793 794 static __inline__ vector unsigned int __ATTRS_o_ai 795 vec_vadduws(vector bool int __a, vector unsigned int __b) { 796 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 797 } 798 799 static __inline__ vector unsigned int __ATTRS_o_ai 800 vec_vadduws(vector unsigned int __a, vector bool int __b) { 801 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 802 } 803 804 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 805 defined(__SIZEOF_INT128__) 806 /* vec_vadduqm */ 807 808 static __inline__ vector signed __int128 __ATTRS_o_ai 809 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 810 return __a + __b; 811 } 812 813 static __inline__ vector unsigned __int128 __ATTRS_o_ai 814 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 815 return __a + __b; 816 } 817 818 /* vec_vaddeuqm */ 819 820 static __inline__ vector signed __int128 __ATTRS_o_ai 821 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 822 vector signed __int128 __c) { 823 return __builtin_altivec_vaddeuqm(__a, __b, __c); 824 } 825 826 static __inline__ vector unsigned __int128 __ATTRS_o_ai 827 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 828 vector unsigned __int128 __c) { 829 return __builtin_altivec_vaddeuqm(__a, __b, __c); 830 } 831 832 /* vec_vaddcuq */ 833 834 static __inline__ vector signed __int128 __ATTRS_o_ai 835 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 836 return __builtin_altivec_vaddcuq(__a, __b); 837 } 838 839 static __inline__ vector unsigned __int128 __ATTRS_o_ai 840 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 841 return __builtin_altivec_vaddcuq(__a, __b); 842 } 843 844 /* vec_vaddecuq */ 845 846 static __inline__ vector signed __int128 __ATTRS_o_ai 847 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 848 vector signed __int128 __c) { 849 return __builtin_altivec_vaddecuq(__a, __b, __c); 850 } 851 852 static __inline__ vector unsigned __int128 __ATTRS_o_ai 853 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 854 vector unsigned __int128 __c) { 855 return __builtin_altivec_vaddecuq(__a, __b, __c); 856 } 857 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 858 859 /* vec_and */ 860 861 #define __builtin_altivec_vand vec_and 862 863 static __inline__ vector signed char __ATTRS_o_ai 864 vec_and(vector signed char __a, vector signed char __b) { 865 return __a & __b; 866 } 867 868 static __inline__ vector signed char __ATTRS_o_ai 869 vec_and(vector bool char __a, vector signed char __b) { 870 return (vector signed char)__a & __b; 871 } 872 873 static __inline__ vector signed char __ATTRS_o_ai 874 vec_and(vector signed char __a, vector bool char __b) { 875 return __a & (vector signed char)__b; 876 } 877 878 static __inline__ vector unsigned char __ATTRS_o_ai 879 vec_and(vector unsigned char __a, vector unsigned char __b) { 880 return __a & __b; 881 } 882 883 static __inline__ vector unsigned char __ATTRS_o_ai 884 vec_and(vector bool char __a, vector unsigned char __b) { 885 return (vector unsigned char)__a & __b; 886 } 887 888 static __inline__ vector unsigned char __ATTRS_o_ai 889 vec_and(vector unsigned char __a, vector bool char __b) { 890 return __a & (vector unsigned char)__b; 891 } 892 893 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 894 vector bool char __b) { 895 return __a & __b; 896 } 897 898 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 899 vector short __b) { 900 return __a & __b; 901 } 902 903 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 904 vector short __b) { 905 return (vector short)__a & __b; 906 } 907 908 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 909 vector bool short __b) { 910 return __a & (vector short)__b; 911 } 912 913 static __inline__ vector unsigned short __ATTRS_o_ai 914 vec_and(vector unsigned short __a, vector unsigned short __b) { 915 return __a & __b; 916 } 917 918 static __inline__ vector unsigned short __ATTRS_o_ai 919 vec_and(vector bool short __a, vector unsigned short __b) { 920 return (vector unsigned short)__a & __b; 921 } 922 923 static __inline__ vector unsigned short __ATTRS_o_ai 924 vec_and(vector unsigned short __a, vector bool short __b) { 925 return __a & (vector unsigned short)__b; 926 } 927 928 static __inline__ vector bool short __ATTRS_o_ai 929 vec_and(vector bool short __a, vector bool short __b) { 930 return __a & __b; 931 } 932 933 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 934 vector int __b) { 935 return __a & __b; 936 } 937 938 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 939 vector int __b) { 940 return (vector int)__a & __b; 941 } 942 943 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 944 vector bool int __b) { 945 return __a & (vector int)__b; 946 } 947 948 static __inline__ vector unsigned int __ATTRS_o_ai 949 vec_and(vector unsigned int __a, vector unsigned int __b) { 950 return __a & __b; 951 } 952 953 static __inline__ vector unsigned int __ATTRS_o_ai 954 vec_and(vector bool int __a, vector unsigned int __b) { 955 return (vector unsigned int)__a & __b; 956 } 957 958 static __inline__ vector unsigned int __ATTRS_o_ai 959 vec_and(vector unsigned int __a, vector bool int __b) { 960 return __a & (vector unsigned int)__b; 961 } 962 963 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 964 vector bool int __b) { 965 return __a & __b; 966 } 967 968 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 969 vector float __b) { 970 vector unsigned int __res = 971 (vector unsigned int)__a & (vector unsigned int)__b; 972 return (vector float)__res; 973 } 974 975 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 976 vector float __b) { 977 vector unsigned int __res = 978 (vector unsigned int)__a & (vector unsigned int)__b; 979 return (vector float)__res; 980 } 981 982 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 983 vector bool int __b) { 984 vector unsigned int __res = 985 (vector unsigned int)__a & (vector unsigned int)__b; 986 return (vector float)__res; 987 } 988 989 #ifdef __VSX__ 990 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 991 vector double __b) { 992 vector unsigned long long __res = 993 (vector unsigned long long)__a & (vector unsigned long long)__b; 994 return (vector double)__res; 995 } 996 997 static __inline__ vector double __ATTRS_o_ai 998 vec_and(vector double __a, vector bool long long __b) { 999 vector unsigned long long __res = 1000 (vector unsigned long long)__a & (vector unsigned long long)__b; 1001 return (vector double)__res; 1002 } 1003 1004 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 1005 vector double __b) { 1006 vector unsigned long long __res = 1007 (vector unsigned long long)__a & (vector unsigned long long)__b; 1008 return (vector double)__res; 1009 } 1010 1011 static __inline__ vector signed long long __ATTRS_o_ai 1012 vec_and(vector signed long long __a, vector signed long long __b) { 1013 return __a & __b; 1014 } 1015 1016 static __inline__ vector signed long long __ATTRS_o_ai 1017 vec_and(vector bool long long __a, vector signed long long __b) { 1018 return (vector signed long long)__a & __b; 1019 } 1020 1021 static __inline__ vector signed long long __ATTRS_o_ai 1022 vec_and(vector signed long long __a, vector bool long long __b) { 1023 return __a & (vector signed long long)__b; 1024 } 1025 1026 static __inline__ vector unsigned long long __ATTRS_o_ai 1027 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 1028 return __a & __b; 1029 } 1030 1031 static __inline__ vector unsigned long long __ATTRS_o_ai 1032 vec_and(vector bool long long __a, vector unsigned long long __b) { 1033 return (vector unsigned long long)__a & __b; 1034 } 1035 1036 static __inline__ vector unsigned long long __ATTRS_o_ai 1037 vec_and(vector unsigned long long __a, vector bool long long __b) { 1038 return __a & (vector unsigned long long)__b; 1039 } 1040 1041 static __inline__ vector bool long long __ATTRS_o_ai 1042 vec_and(vector bool long long __a, vector bool long long __b) { 1043 return __a & __b; 1044 } 1045 #endif 1046 1047 /* vec_vand */ 1048 1049 static __inline__ vector signed char __ATTRS_o_ai 1050 vec_vand(vector signed char __a, vector signed char __b) { 1051 return __a & __b; 1052 } 1053 1054 static __inline__ vector signed char __ATTRS_o_ai 1055 vec_vand(vector bool char __a, vector signed char __b) { 1056 return (vector signed char)__a & __b; 1057 } 1058 1059 static __inline__ vector signed char __ATTRS_o_ai 1060 vec_vand(vector signed char __a, vector bool char __b) { 1061 return __a & (vector signed char)__b; 1062 } 1063 1064 static __inline__ vector unsigned char __ATTRS_o_ai 1065 vec_vand(vector unsigned char __a, vector unsigned char __b) { 1066 return __a & __b; 1067 } 1068 1069 static __inline__ vector unsigned char __ATTRS_o_ai 1070 vec_vand(vector bool char __a, vector unsigned char __b) { 1071 return (vector unsigned char)__a & __b; 1072 } 1073 1074 static __inline__ vector unsigned char __ATTRS_o_ai 1075 vec_vand(vector unsigned char __a, vector bool char __b) { 1076 return __a & (vector unsigned char)__b; 1077 } 1078 1079 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 1080 vector bool char __b) { 1081 return __a & __b; 1082 } 1083 1084 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1085 vector short __b) { 1086 return __a & __b; 1087 } 1088 1089 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 1090 vector short __b) { 1091 return (vector short)__a & __b; 1092 } 1093 1094 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1095 vector bool short __b) { 1096 return __a & (vector short)__b; 1097 } 1098 1099 static __inline__ vector unsigned short __ATTRS_o_ai 1100 vec_vand(vector unsigned short __a, vector unsigned short __b) { 1101 return __a & __b; 1102 } 1103 1104 static __inline__ vector unsigned short __ATTRS_o_ai 1105 vec_vand(vector bool short __a, vector unsigned short __b) { 1106 return (vector unsigned short)__a & __b; 1107 } 1108 1109 static __inline__ vector unsigned short __ATTRS_o_ai 1110 vec_vand(vector unsigned short __a, vector bool short __b) { 1111 return __a & (vector unsigned short)__b; 1112 } 1113 1114 static __inline__ vector bool short __ATTRS_o_ai 1115 vec_vand(vector bool short __a, vector bool short __b) { 1116 return __a & __b; 1117 } 1118 1119 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1120 vector int __b) { 1121 return __a & __b; 1122 } 1123 1124 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 1125 vector int __b) { 1126 return (vector int)__a & __b; 1127 } 1128 1129 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1130 vector bool int __b) { 1131 return __a & (vector int)__b; 1132 } 1133 1134 static __inline__ vector unsigned int __ATTRS_o_ai 1135 vec_vand(vector unsigned int __a, vector unsigned int __b) { 1136 return __a & __b; 1137 } 1138 1139 static __inline__ vector unsigned int __ATTRS_o_ai 1140 vec_vand(vector bool int __a, vector unsigned int __b) { 1141 return (vector unsigned int)__a & __b; 1142 } 1143 1144 static __inline__ vector unsigned int __ATTRS_o_ai 1145 vec_vand(vector unsigned int __a, vector bool int __b) { 1146 return __a & (vector unsigned int)__b; 1147 } 1148 1149 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1150 vector bool int __b) { 1151 return __a & __b; 1152 } 1153 1154 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1155 vector float __b) { 1156 vector unsigned int __res = 1157 (vector unsigned int)__a & (vector unsigned int)__b; 1158 return (vector float)__res; 1159 } 1160 1161 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1162 vector float __b) { 1163 vector unsigned int __res = 1164 (vector unsigned int)__a & (vector unsigned int)__b; 1165 return (vector float)__res; 1166 } 1167 1168 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1169 vector bool int __b) { 1170 vector unsigned int __res = 1171 (vector unsigned int)__a & (vector unsigned int)__b; 1172 return (vector float)__res; 1173 } 1174 1175 #ifdef __VSX__ 1176 static __inline__ vector signed long long __ATTRS_o_ai 1177 vec_vand(vector signed long long __a, vector signed long long __b) { 1178 return __a & __b; 1179 } 1180 1181 static __inline__ vector signed long long __ATTRS_o_ai 1182 vec_vand(vector bool long long __a, vector signed long long __b) { 1183 return (vector signed long long)__a & __b; 1184 } 1185 1186 static __inline__ vector signed long long __ATTRS_o_ai 1187 vec_vand(vector signed long long __a, vector bool long long __b) { 1188 return __a & (vector signed long long)__b; 1189 } 1190 1191 static __inline__ vector unsigned long long __ATTRS_o_ai 1192 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1193 return __a & __b; 1194 } 1195 1196 static __inline__ vector unsigned long long __ATTRS_o_ai 1197 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1198 return (vector unsigned long long)__a & __b; 1199 } 1200 1201 static __inline__ vector unsigned long long __ATTRS_o_ai 1202 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1203 return __a & (vector unsigned long long)__b; 1204 } 1205 1206 static __inline__ vector bool long long __ATTRS_o_ai 1207 vec_vand(vector bool long long __a, vector bool long long __b) { 1208 return __a & __b; 1209 } 1210 #endif 1211 1212 /* vec_andc */ 1213 1214 #define __builtin_altivec_vandc vec_andc 1215 1216 static __inline__ vector signed char __ATTRS_o_ai 1217 vec_andc(vector signed char __a, vector signed char __b) { 1218 return __a & ~__b; 1219 } 1220 1221 static __inline__ vector signed char __ATTRS_o_ai 1222 vec_andc(vector bool char __a, vector signed char __b) { 1223 return (vector signed char)__a & ~__b; 1224 } 1225 1226 static __inline__ vector signed char __ATTRS_o_ai 1227 vec_andc(vector signed char __a, vector bool char __b) { 1228 return __a & ~(vector signed char)__b; 1229 } 1230 1231 static __inline__ vector unsigned char __ATTRS_o_ai 1232 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1233 return __a & ~__b; 1234 } 1235 1236 static __inline__ vector unsigned char __ATTRS_o_ai 1237 vec_andc(vector bool char __a, vector unsigned char __b) { 1238 return (vector unsigned char)__a & ~__b; 1239 } 1240 1241 static __inline__ vector unsigned char __ATTRS_o_ai 1242 vec_andc(vector unsigned char __a, vector bool char __b) { 1243 return __a & ~(vector unsigned char)__b; 1244 } 1245 1246 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1247 vector bool char __b) { 1248 return __a & ~__b; 1249 } 1250 1251 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1252 vector short __b) { 1253 return __a & ~__b; 1254 } 1255 1256 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1257 vector short __b) { 1258 return (vector short)__a & ~__b; 1259 } 1260 1261 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1262 vector bool short __b) { 1263 return __a & ~(vector short)__b; 1264 } 1265 1266 static __inline__ vector unsigned short __ATTRS_o_ai 1267 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1268 return __a & ~__b; 1269 } 1270 1271 static __inline__ vector unsigned short __ATTRS_o_ai 1272 vec_andc(vector bool short __a, vector unsigned short __b) { 1273 return (vector unsigned short)__a & ~__b; 1274 } 1275 1276 static __inline__ vector unsigned short __ATTRS_o_ai 1277 vec_andc(vector unsigned short __a, vector bool short __b) { 1278 return __a & ~(vector unsigned short)__b; 1279 } 1280 1281 static __inline__ vector bool short __ATTRS_o_ai 1282 vec_andc(vector bool short __a, vector bool short __b) { 1283 return __a & ~__b; 1284 } 1285 1286 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1287 vector int __b) { 1288 return __a & ~__b; 1289 } 1290 1291 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1292 vector int __b) { 1293 return (vector int)__a & ~__b; 1294 } 1295 1296 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1297 vector bool int __b) { 1298 return __a & ~(vector int)__b; 1299 } 1300 1301 static __inline__ vector unsigned int __ATTRS_o_ai 1302 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1303 return __a & ~__b; 1304 } 1305 1306 static __inline__ vector unsigned int __ATTRS_o_ai 1307 vec_andc(vector bool int __a, vector unsigned int __b) { 1308 return (vector unsigned int)__a & ~__b; 1309 } 1310 1311 static __inline__ vector unsigned int __ATTRS_o_ai 1312 vec_andc(vector unsigned int __a, vector bool int __b) { 1313 return __a & ~(vector unsigned int)__b; 1314 } 1315 1316 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1317 vector bool int __b) { 1318 return __a & ~__b; 1319 } 1320 1321 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1322 vector float __b) { 1323 vector unsigned int __res = 1324 (vector unsigned int)__a & ~(vector unsigned int)__b; 1325 return (vector float)__res; 1326 } 1327 1328 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1329 vector float __b) { 1330 vector unsigned int __res = 1331 (vector unsigned int)__a & ~(vector unsigned int)__b; 1332 return (vector float)__res; 1333 } 1334 1335 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1336 vector bool int __b) { 1337 vector unsigned int __res = 1338 (vector unsigned int)__a & ~(vector unsigned int)__b; 1339 return (vector float)__res; 1340 } 1341 1342 #ifdef __VSX__ 1343 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1344 vector double __b) { 1345 vector unsigned long long __res = 1346 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1347 return (vector double)__res; 1348 } 1349 1350 static __inline__ vector double __ATTRS_o_ai 1351 vec_andc(vector double __a, vector bool long long __b) { 1352 vector unsigned long long __res = 1353 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1354 return (vector double)__res; 1355 } 1356 1357 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1358 vector double __b) { 1359 vector unsigned long long __res = 1360 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1361 return (vector double)__res; 1362 } 1363 1364 static __inline__ vector signed long long __ATTRS_o_ai 1365 vec_andc(vector signed long long __a, vector signed long long __b) { 1366 return __a & ~__b; 1367 } 1368 1369 static __inline__ vector signed long long __ATTRS_o_ai 1370 vec_andc(vector bool long long __a, vector signed long long __b) { 1371 return (vector signed long long)__a & ~__b; 1372 } 1373 1374 static __inline__ vector signed long long __ATTRS_o_ai 1375 vec_andc(vector signed long long __a, vector bool long long __b) { 1376 return __a & ~(vector signed long long)__b; 1377 } 1378 1379 static __inline__ vector unsigned long long __ATTRS_o_ai 1380 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1381 return __a & ~__b; 1382 } 1383 1384 static __inline__ vector unsigned long long __ATTRS_o_ai 1385 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1386 return (vector unsigned long long)__a & ~__b; 1387 } 1388 1389 static __inline__ vector unsigned long long __ATTRS_o_ai 1390 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1391 return __a & ~(vector unsigned long long)__b; 1392 } 1393 1394 static __inline__ vector bool long long __ATTRS_o_ai 1395 vec_andc(vector bool long long __a, vector bool long long __b) { 1396 return __a & ~__b; 1397 } 1398 #endif 1399 1400 /* vec_vandc */ 1401 1402 static __inline__ vector signed char __ATTRS_o_ai 1403 vec_vandc(vector signed char __a, vector signed char __b) { 1404 return __a & ~__b; 1405 } 1406 1407 static __inline__ vector signed char __ATTRS_o_ai 1408 vec_vandc(vector bool char __a, vector signed char __b) { 1409 return (vector signed char)__a & ~__b; 1410 } 1411 1412 static __inline__ vector signed char __ATTRS_o_ai 1413 vec_vandc(vector signed char __a, vector bool char __b) { 1414 return __a & ~(vector signed char)__b; 1415 } 1416 1417 static __inline__ vector unsigned char __ATTRS_o_ai 1418 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1419 return __a & ~__b; 1420 } 1421 1422 static __inline__ vector unsigned char __ATTRS_o_ai 1423 vec_vandc(vector bool char __a, vector unsigned char __b) { 1424 return (vector unsigned char)__a & ~__b; 1425 } 1426 1427 static __inline__ vector unsigned char __ATTRS_o_ai 1428 vec_vandc(vector unsigned char __a, vector bool char __b) { 1429 return __a & ~(vector unsigned char)__b; 1430 } 1431 1432 static __inline__ vector bool char __ATTRS_o_ai 1433 vec_vandc(vector bool char __a, vector bool char __b) { 1434 return __a & ~__b; 1435 } 1436 1437 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1438 vector short __b) { 1439 return __a & ~__b; 1440 } 1441 1442 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1443 vector short __b) { 1444 return (vector short)__a & ~__b; 1445 } 1446 1447 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1448 vector bool short __b) { 1449 return __a & ~(vector short)__b; 1450 } 1451 1452 static __inline__ vector unsigned short __ATTRS_o_ai 1453 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1454 return __a & ~__b; 1455 } 1456 1457 static __inline__ vector unsigned short __ATTRS_o_ai 1458 vec_vandc(vector bool short __a, vector unsigned short __b) { 1459 return (vector unsigned short)__a & ~__b; 1460 } 1461 1462 static __inline__ vector unsigned short __ATTRS_o_ai 1463 vec_vandc(vector unsigned short __a, vector bool short __b) { 1464 return __a & ~(vector unsigned short)__b; 1465 } 1466 1467 static __inline__ vector bool short __ATTRS_o_ai 1468 vec_vandc(vector bool short __a, vector bool short __b) { 1469 return __a & ~__b; 1470 } 1471 1472 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1473 vector int __b) { 1474 return __a & ~__b; 1475 } 1476 1477 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1478 vector int __b) { 1479 return (vector int)__a & ~__b; 1480 } 1481 1482 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1483 vector bool int __b) { 1484 return __a & ~(vector int)__b; 1485 } 1486 1487 static __inline__ vector unsigned int __ATTRS_o_ai 1488 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1489 return __a & ~__b; 1490 } 1491 1492 static __inline__ vector unsigned int __ATTRS_o_ai 1493 vec_vandc(vector bool int __a, vector unsigned int __b) { 1494 return (vector unsigned int)__a & ~__b; 1495 } 1496 1497 static __inline__ vector unsigned int __ATTRS_o_ai 1498 vec_vandc(vector unsigned int __a, vector bool int __b) { 1499 return __a & ~(vector unsigned int)__b; 1500 } 1501 1502 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1503 vector bool int __b) { 1504 return __a & ~__b; 1505 } 1506 1507 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1508 vector float __b) { 1509 vector unsigned int __res = 1510 (vector unsigned int)__a & ~(vector unsigned int)__b; 1511 return (vector float)__res; 1512 } 1513 1514 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1515 vector float __b) { 1516 vector unsigned int __res = 1517 (vector unsigned int)__a & ~(vector unsigned int)__b; 1518 return (vector float)__res; 1519 } 1520 1521 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1522 vector bool int __b) { 1523 vector unsigned int __res = 1524 (vector unsigned int)__a & ~(vector unsigned int)__b; 1525 return (vector float)__res; 1526 } 1527 1528 #ifdef __VSX__ 1529 static __inline__ vector signed long long __ATTRS_o_ai 1530 vec_vandc(vector signed long long __a, vector signed long long __b) { 1531 return __a & ~__b; 1532 } 1533 1534 static __inline__ vector signed long long __ATTRS_o_ai 1535 vec_vandc(vector bool long long __a, vector signed long long __b) { 1536 return (vector signed long long)__a & ~__b; 1537 } 1538 1539 static __inline__ vector signed long long __ATTRS_o_ai 1540 vec_vandc(vector signed long long __a, vector bool long long __b) { 1541 return __a & ~(vector signed long long)__b; 1542 } 1543 1544 static __inline__ vector unsigned long long __ATTRS_o_ai 1545 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1546 return __a & ~__b; 1547 } 1548 1549 static __inline__ vector unsigned long long __ATTRS_o_ai 1550 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1551 return (vector unsigned long long)__a & ~__b; 1552 } 1553 1554 static __inline__ vector unsigned long long __ATTRS_o_ai 1555 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1556 return __a & ~(vector unsigned long long)__b; 1557 } 1558 1559 static __inline__ vector bool long long __ATTRS_o_ai 1560 vec_vandc(vector bool long long __a, vector bool long long __b) { 1561 return __a & ~__b; 1562 } 1563 #endif 1564 1565 /* vec_avg */ 1566 1567 static __inline__ vector signed char __ATTRS_o_ai 1568 vec_avg(vector signed char __a, vector signed char __b) { 1569 return __builtin_altivec_vavgsb(__a, __b); 1570 } 1571 1572 static __inline__ vector unsigned char __ATTRS_o_ai 1573 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1574 return __builtin_altivec_vavgub(__a, __b); 1575 } 1576 1577 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1578 vector short __b) { 1579 return __builtin_altivec_vavgsh(__a, __b); 1580 } 1581 1582 static __inline__ vector unsigned short __ATTRS_o_ai 1583 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1584 return __builtin_altivec_vavguh(__a, __b); 1585 } 1586 1587 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1588 vector int __b) { 1589 return __builtin_altivec_vavgsw(__a, __b); 1590 } 1591 1592 static __inline__ vector unsigned int __ATTRS_o_ai 1593 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1594 return __builtin_altivec_vavguw(__a, __b); 1595 } 1596 1597 /* vec_vavgsb */ 1598 1599 static __inline__ vector signed char __attribute__((__always_inline__)) 1600 vec_vavgsb(vector signed char __a, vector signed char __b) { 1601 return __builtin_altivec_vavgsb(__a, __b); 1602 } 1603 1604 /* vec_vavgub */ 1605 1606 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1607 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1608 return __builtin_altivec_vavgub(__a, __b); 1609 } 1610 1611 /* vec_vavgsh */ 1612 1613 static __inline__ vector short __attribute__((__always_inline__)) 1614 vec_vavgsh(vector short __a, vector short __b) { 1615 return __builtin_altivec_vavgsh(__a, __b); 1616 } 1617 1618 /* vec_vavguh */ 1619 1620 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1621 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1622 return __builtin_altivec_vavguh(__a, __b); 1623 } 1624 1625 /* vec_vavgsw */ 1626 1627 static __inline__ vector int __attribute__((__always_inline__)) 1628 vec_vavgsw(vector int __a, vector int __b) { 1629 return __builtin_altivec_vavgsw(__a, __b); 1630 } 1631 1632 /* vec_vavguw */ 1633 1634 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1635 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1636 return __builtin_altivec_vavguw(__a, __b); 1637 } 1638 1639 /* vec_ceil */ 1640 1641 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1642 #ifdef __VSX__ 1643 return __builtin_vsx_xvrspip(__a); 1644 #else 1645 return __builtin_altivec_vrfip(__a); 1646 #endif 1647 } 1648 1649 #ifdef __VSX__ 1650 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1651 return __builtin_vsx_xvrdpip(__a); 1652 } 1653 #endif 1654 1655 /* vec_roundp */ 1656 static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { 1657 return vec_ceil(__a); 1658 } 1659 1660 #ifdef __VSX__ 1661 static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { 1662 return vec_ceil(__a); 1663 } 1664 #endif 1665 1666 /* vec_vrfip */ 1667 1668 static __inline__ vector float __attribute__((__always_inline__)) 1669 vec_vrfip(vector float __a) { 1670 return __builtin_altivec_vrfip(__a); 1671 } 1672 1673 /* vec_cmpb */ 1674 1675 static __inline__ vector int __attribute__((__always_inline__)) 1676 vec_cmpb(vector float __a, vector float __b) { 1677 return __builtin_altivec_vcmpbfp(__a, __b); 1678 } 1679 1680 /* vec_vcmpbfp */ 1681 1682 static __inline__ vector int __attribute__((__always_inline__)) 1683 vec_vcmpbfp(vector float __a, vector float __b) { 1684 return __builtin_altivec_vcmpbfp(__a, __b); 1685 } 1686 1687 /* vec_cmpeq */ 1688 1689 static __inline__ vector bool char __ATTRS_o_ai 1690 vec_cmpeq(vector signed char __a, vector signed char __b) { 1691 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1692 (vector char)__b); 1693 } 1694 1695 static __inline__ vector bool char __ATTRS_o_ai 1696 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1697 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1698 (vector char)__b); 1699 } 1700 1701 static __inline__ vector bool char __ATTRS_o_ai 1702 vec_cmpeq(vector bool char __a, vector bool char __b) { 1703 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1704 (vector char)__b); 1705 } 1706 1707 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1708 vector short __b) { 1709 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1710 } 1711 1712 static __inline__ vector bool short __ATTRS_o_ai 1713 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1714 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1715 (vector short)__b); 1716 } 1717 1718 static __inline__ vector bool short __ATTRS_o_ai 1719 vec_cmpeq(vector bool short __a, vector bool short __b) { 1720 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1721 (vector short)__b); 1722 } 1723 1724 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1725 vector int __b) { 1726 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1727 } 1728 1729 static __inline__ vector bool int __ATTRS_o_ai 1730 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1731 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1732 (vector int)__b); 1733 } 1734 1735 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, 1736 vector bool int __b) { 1737 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1738 (vector int)__b); 1739 } 1740 1741 #ifdef __POWER8_VECTOR__ 1742 static __inline__ vector bool long long __ATTRS_o_ai 1743 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1744 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1745 } 1746 1747 static __inline__ vector bool long long __ATTRS_o_ai 1748 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1749 return (vector bool long long)__builtin_altivec_vcmpequd( 1750 (vector long long)__a, (vector long long)__b); 1751 } 1752 1753 static __inline__ vector bool long long __ATTRS_o_ai 1754 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1755 return (vector bool long long)__builtin_altivec_vcmpequd( 1756 (vector long long)__a, (vector long long)__b); 1757 } 1758 #elif defined(__VSX__) 1759 static __inline__ vector bool long long __ATTRS_o_ai 1760 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1761 vector bool int __wordcmp = 1762 vec_cmpeq((vector signed int)__a, (vector signed int)__b); 1763 #ifdef __LITTLE_ENDIAN__ 1764 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); 1765 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, 1766 1, 3, 3); 1767 #else 1768 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); 1769 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, 1770 0, 2, 2); 1771 #endif 1772 } 1773 1774 static __inline__ vector bool long long __ATTRS_o_ai 1775 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1776 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1777 } 1778 1779 static __inline__ vector bool long long __ATTRS_o_ai 1780 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1781 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1782 } 1783 #endif 1784 1785 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1786 vector float __b) { 1787 #ifdef __VSX__ 1788 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1789 #else 1790 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1791 #endif 1792 } 1793 1794 #ifdef __VSX__ 1795 static __inline__ vector bool long long __ATTRS_o_ai 1796 vec_cmpeq(vector double __a, vector double __b) { 1797 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1798 } 1799 #endif 1800 1801 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1802 static __inline__ vector bool __int128 __ATTRS_o_ai 1803 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { 1804 return (vector bool __int128)__builtin_altivec_vcmpequq( 1805 (vector bool __int128)__a, (vector bool __int128)__b); 1806 } 1807 1808 static __inline__ vector bool __int128 __ATTRS_o_ai 1809 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1810 return (vector bool __int128)__builtin_altivec_vcmpequq( 1811 (vector bool __int128)__a, (vector bool __int128)__b); 1812 } 1813 1814 static __inline__ vector bool __int128 __ATTRS_o_ai 1815 vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) { 1816 return (vector bool __int128)__builtin_altivec_vcmpequq(__a, __b); 1817 } 1818 #endif 1819 1820 #ifdef __POWER9_VECTOR__ 1821 /* vec_cmpne */ 1822 1823 static __inline__ vector bool char __ATTRS_o_ai 1824 vec_cmpne(vector bool char __a, vector bool char __b) { 1825 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1826 (vector char)__b); 1827 } 1828 1829 static __inline__ vector bool char __ATTRS_o_ai 1830 vec_cmpne(vector signed char __a, vector signed char __b) { 1831 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1832 (vector char)__b); 1833 } 1834 1835 static __inline__ vector bool char __ATTRS_o_ai 1836 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1837 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1838 (vector char)__b); 1839 } 1840 1841 static __inline__ vector bool short __ATTRS_o_ai 1842 vec_cmpne(vector bool short __a, vector bool short __b) { 1843 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1844 (vector short)__b); 1845 } 1846 1847 static __inline__ vector bool short __ATTRS_o_ai 1848 vec_cmpne(vector signed short __a, vector signed short __b) { 1849 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1850 (vector short)__b); 1851 } 1852 1853 static __inline__ vector bool short __ATTRS_o_ai 1854 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1855 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1856 (vector short)__b); 1857 } 1858 1859 static __inline__ vector bool int __ATTRS_o_ai 1860 vec_cmpne(vector bool int __a, vector bool int __b) { 1861 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1862 (vector int)__b); 1863 } 1864 1865 static __inline__ vector bool int __ATTRS_o_ai 1866 vec_cmpne(vector signed int __a, vector signed int __b) { 1867 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1868 (vector int)__b); 1869 } 1870 1871 static __inline__ vector bool int __ATTRS_o_ai 1872 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1873 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1874 (vector int)__b); 1875 } 1876 1877 static __inline__ vector bool int __ATTRS_o_ai 1878 vec_cmpne(vector float __a, vector float __b) { 1879 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1880 (vector int)__b); 1881 } 1882 1883 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1884 static __inline__ vector bool __int128 __ATTRS_o_ai 1885 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1886 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1887 (vector bool __int128)__a, (vector bool __int128)__b)); 1888 } 1889 1890 static __inline__ vector bool __int128 __ATTRS_o_ai 1891 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { 1892 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1893 (vector bool __int128)__a, (vector bool __int128)__b)); 1894 } 1895 1896 static __inline__ vector bool __int128 __ATTRS_o_ai 1897 vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) { 1898 return (vector bool __int128) ~(__builtin_altivec_vcmpequq(__a, __b)); 1899 } 1900 #endif 1901 1902 /* vec_cmpnez */ 1903 1904 static __inline__ vector bool char __ATTRS_o_ai 1905 vec_cmpnez(vector signed char __a, vector signed char __b) { 1906 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1907 (vector char)__b); 1908 } 1909 1910 static __inline__ vector bool char __ATTRS_o_ai 1911 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1912 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1913 (vector char)__b); 1914 } 1915 1916 static __inline__ vector bool short __ATTRS_o_ai 1917 vec_cmpnez(vector signed short __a, vector signed short __b) { 1918 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1919 (vector short)__b); 1920 } 1921 1922 static __inline__ vector bool short __ATTRS_o_ai 1923 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1924 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1925 (vector short)__b); 1926 } 1927 1928 static __inline__ vector bool int __ATTRS_o_ai 1929 vec_cmpnez(vector signed int __a, vector signed int __b) { 1930 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1931 (vector int)__b); 1932 } 1933 1934 static __inline__ vector bool int __ATTRS_o_ai 1935 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1936 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1937 (vector int)__b); 1938 } 1939 1940 static __inline__ signed int __ATTRS_o_ai 1941 vec_cntlz_lsbb(vector signed char __a) { 1942 #ifdef __LITTLE_ENDIAN__ 1943 return __builtin_altivec_vctzlsbb(__a); 1944 #else 1945 return __builtin_altivec_vclzlsbb(__a); 1946 #endif 1947 } 1948 1949 static __inline__ signed int __ATTRS_o_ai 1950 vec_cntlz_lsbb(vector unsigned char __a) { 1951 #ifdef __LITTLE_ENDIAN__ 1952 return __builtin_altivec_vctzlsbb(__a); 1953 #else 1954 return __builtin_altivec_vclzlsbb(__a); 1955 #endif 1956 } 1957 1958 static __inline__ signed int __ATTRS_o_ai 1959 vec_cnttz_lsbb(vector signed char __a) { 1960 #ifdef __LITTLE_ENDIAN__ 1961 return __builtin_altivec_vclzlsbb(__a); 1962 #else 1963 return __builtin_altivec_vctzlsbb(__a); 1964 #endif 1965 } 1966 1967 static __inline__ signed int __ATTRS_o_ai 1968 vec_cnttz_lsbb(vector unsigned char __a) { 1969 #ifdef __LITTLE_ENDIAN__ 1970 return __builtin_altivec_vclzlsbb(__a); 1971 #else 1972 return __builtin_altivec_vctzlsbb(__a); 1973 #endif 1974 } 1975 1976 static __inline__ vector unsigned int __ATTRS_o_ai 1977 vec_parity_lsbb(vector unsigned int __a) { 1978 return __builtin_altivec_vprtybw(__a); 1979 } 1980 1981 static __inline__ vector unsigned int __ATTRS_o_ai 1982 vec_parity_lsbb(vector signed int __a) { 1983 return __builtin_altivec_vprtybw(__a); 1984 } 1985 1986 #ifdef __SIZEOF_INT128__ 1987 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1988 vec_parity_lsbb(vector unsigned __int128 __a) { 1989 return __builtin_altivec_vprtybq(__a); 1990 } 1991 1992 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1993 vec_parity_lsbb(vector signed __int128 __a) { 1994 return __builtin_altivec_vprtybq(__a); 1995 } 1996 #endif 1997 1998 static __inline__ vector unsigned long long __ATTRS_o_ai 1999 vec_parity_lsbb(vector unsigned long long __a) { 2000 return __builtin_altivec_vprtybd(__a); 2001 } 2002 2003 static __inline__ vector unsigned long long __ATTRS_o_ai 2004 vec_parity_lsbb(vector signed long long __a) { 2005 return __builtin_altivec_vprtybd(__a); 2006 } 2007 2008 #else 2009 /* vec_cmpne */ 2010 2011 static __inline__ vector bool char __ATTRS_o_ai 2012 vec_cmpne(vector bool char __a, vector bool char __b) { 2013 return ~(vec_cmpeq(__a, __b)); 2014 } 2015 2016 static __inline__ vector bool char __ATTRS_o_ai 2017 vec_cmpne(vector signed char __a, vector signed char __b) { 2018 return ~(vec_cmpeq(__a, __b)); 2019 } 2020 2021 static __inline__ vector bool char __ATTRS_o_ai 2022 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 2023 return ~(vec_cmpeq(__a, __b)); 2024 } 2025 2026 static __inline__ vector bool short __ATTRS_o_ai 2027 vec_cmpne(vector bool short __a, vector bool short __b) { 2028 return ~(vec_cmpeq(__a, __b)); 2029 } 2030 2031 static __inline__ vector bool short __ATTRS_o_ai 2032 vec_cmpne(vector signed short __a, vector signed short __b) { 2033 return ~(vec_cmpeq(__a, __b)); 2034 } 2035 2036 static __inline__ vector bool short __ATTRS_o_ai 2037 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 2038 return ~(vec_cmpeq(__a, __b)); 2039 } 2040 2041 static __inline__ vector bool int __ATTRS_o_ai 2042 vec_cmpne(vector bool int __a, vector bool int __b) { 2043 return ~(vec_cmpeq(__a, __b)); 2044 } 2045 2046 static __inline__ vector bool int __ATTRS_o_ai 2047 vec_cmpne(vector signed int __a, vector signed int __b) { 2048 return ~(vec_cmpeq(__a, __b)); 2049 } 2050 2051 static __inline__ vector bool int __ATTRS_o_ai 2052 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 2053 return ~(vec_cmpeq(__a, __b)); 2054 } 2055 2056 static __inline__ vector bool int __ATTRS_o_ai 2057 vec_cmpne(vector float __a, vector float __b) { 2058 return ~(vec_cmpeq(__a, __b)); 2059 } 2060 #endif 2061 2062 #ifdef __POWER8_VECTOR__ 2063 static __inline__ vector bool long long __ATTRS_o_ai 2064 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2065 return (vector bool long long) 2066 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2067 } 2068 2069 static __inline__ vector bool long long __ATTRS_o_ai 2070 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2071 return (vector bool long long) 2072 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2073 } 2074 2075 static __inline__ vector bool long long __ATTRS_o_ai 2076 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2077 return (vector bool long long) 2078 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2079 } 2080 #elif defined(__VSX__) 2081 static __inline__ vector bool long long __ATTRS_o_ai 2082 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2083 return (vector bool long long)~( 2084 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2085 } 2086 2087 static __inline__ vector bool long long __ATTRS_o_ai 2088 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2089 return (vector bool long long)~( 2090 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2091 } 2092 2093 static __inline__ vector bool long long __ATTRS_o_ai 2094 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2095 return (vector bool long long)~( 2096 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2097 } 2098 #endif 2099 2100 #ifdef __VSX__ 2101 static __inline__ vector bool long long __ATTRS_o_ai 2102 vec_cmpne(vector double __a, vector double __b) { 2103 return (vector bool long long) 2104 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2105 } 2106 #endif 2107 2108 /* vec_cmpgt */ 2109 2110 static __inline__ vector bool char __ATTRS_o_ai 2111 vec_cmpgt(vector signed char __a, vector signed char __b) { 2112 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2113 } 2114 2115 static __inline__ vector bool char __ATTRS_o_ai 2116 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 2117 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2118 } 2119 2120 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 2121 vector short __b) { 2122 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2123 } 2124 2125 static __inline__ vector bool short __ATTRS_o_ai 2126 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 2127 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2128 } 2129 2130 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 2131 vector int __b) { 2132 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2133 } 2134 2135 static __inline__ vector bool int __ATTRS_o_ai 2136 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 2137 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2138 } 2139 2140 #ifdef __POWER8_VECTOR__ 2141 static __inline__ vector bool long long __ATTRS_o_ai 2142 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2143 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 2144 } 2145 2146 static __inline__ vector bool long long __ATTRS_o_ai 2147 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2148 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2149 } 2150 #elif defined(__VSX__) 2151 static __inline__ vector bool long long __ATTRS_o_ai 2152 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2153 vector signed int __sgtw = (vector signed int)vec_cmpgt( 2154 (vector signed int)__a, (vector signed int)__b); 2155 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2156 (vector unsigned int)__a, (vector unsigned int)__b); 2157 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2158 (vector signed int)__a, (vector signed int)__b); 2159 #ifdef __LITTLE_ENDIAN__ 2160 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2161 __sgtw |= (vector signed int)__ugtw; 2162 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, 2163 3); 2164 #else 2165 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2166 __sgtw |= (vector signed int)__ugtw; 2167 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, 2168 2); 2169 #endif 2170 } 2171 2172 static __inline__ vector bool long long __ATTRS_o_ai 2173 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2174 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2175 (vector unsigned int)__a, (vector unsigned int)__b); 2176 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2177 (vector signed int)__a, (vector signed int)__b); 2178 #ifdef __LITTLE_ENDIAN__ 2179 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2180 __ugtw |= __eqw; 2181 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, 2182 3); 2183 #else 2184 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2185 __ugtw |= __eqw; 2186 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, 2187 2); 2188 #endif 2189 } 2190 #endif 2191 2192 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2193 vector float __b) { 2194 #ifdef __VSX__ 2195 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2196 #else 2197 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2198 #endif 2199 } 2200 2201 #ifdef __VSX__ 2202 static __inline__ vector bool long long __ATTRS_o_ai 2203 vec_cmpgt(vector double __a, vector double __b) { 2204 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2205 } 2206 #endif 2207 2208 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2209 static __inline__ vector bool __int128 __ATTRS_o_ai 2210 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { 2211 return (vector bool __int128)__builtin_altivec_vcmpgtsq( 2212 (vector bool __int128)__a, (vector bool __int128)__b); 2213 } 2214 2215 static __inline__ vector bool __int128 __ATTRS_o_ai 2216 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2217 return (vector bool __int128)__builtin_altivec_vcmpgtuq( 2218 (vector bool __int128)__a, (vector bool __int128)__b); 2219 } 2220 #endif 2221 2222 /* vec_cmpge */ 2223 2224 static __inline__ vector bool char __ATTRS_o_ai 2225 vec_cmpge(vector signed char __a, vector signed char __b) { 2226 return ~(vec_cmpgt(__b, __a)); 2227 } 2228 2229 static __inline__ vector bool char __ATTRS_o_ai 2230 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2231 return ~(vec_cmpgt(__b, __a)); 2232 } 2233 2234 static __inline__ vector bool short __ATTRS_o_ai 2235 vec_cmpge(vector signed short __a, vector signed short __b) { 2236 return ~(vec_cmpgt(__b, __a)); 2237 } 2238 2239 static __inline__ vector bool short __ATTRS_o_ai 2240 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2241 return ~(vec_cmpgt(__b, __a)); 2242 } 2243 2244 static __inline__ vector bool int __ATTRS_o_ai 2245 vec_cmpge(vector signed int __a, vector signed int __b) { 2246 return ~(vec_cmpgt(__b, __a)); 2247 } 2248 2249 static __inline__ vector bool int __ATTRS_o_ai 2250 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2251 return ~(vec_cmpgt(__b, __a)); 2252 } 2253 2254 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2255 vector float __b) { 2256 #ifdef __VSX__ 2257 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2258 #else 2259 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2260 #endif 2261 } 2262 2263 #ifdef __VSX__ 2264 static __inline__ vector bool long long __ATTRS_o_ai 2265 vec_cmpge(vector double __a, vector double __b) { 2266 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2267 } 2268 2269 static __inline__ vector bool long long __ATTRS_o_ai 2270 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2271 return ~(vec_cmpgt(__b, __a)); 2272 } 2273 2274 static __inline__ vector bool long long __ATTRS_o_ai 2275 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2276 return ~(vec_cmpgt(__b, __a)); 2277 } 2278 #endif 2279 2280 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2281 static __inline__ vector bool __int128 __ATTRS_o_ai 2282 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { 2283 return ~(vec_cmpgt(__b, __a)); 2284 } 2285 2286 static __inline__ vector bool __int128 __ATTRS_o_ai 2287 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2288 return ~(vec_cmpgt(__b, __a)); 2289 } 2290 #endif 2291 2292 /* vec_vcmpgefp */ 2293 2294 static __inline__ vector bool int __attribute__((__always_inline__)) 2295 vec_vcmpgefp(vector float __a, vector float __b) { 2296 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2297 } 2298 2299 /* vec_vcmpgtsb */ 2300 2301 static __inline__ vector bool char __attribute__((__always_inline__)) 2302 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2303 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2304 } 2305 2306 /* vec_vcmpgtub */ 2307 2308 static __inline__ vector bool char __attribute__((__always_inline__)) 2309 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2310 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2311 } 2312 2313 /* vec_vcmpgtsh */ 2314 2315 static __inline__ vector bool short __attribute__((__always_inline__)) 2316 vec_vcmpgtsh(vector short __a, vector short __b) { 2317 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2318 } 2319 2320 /* vec_vcmpgtuh */ 2321 2322 static __inline__ vector bool short __attribute__((__always_inline__)) 2323 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2324 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2325 } 2326 2327 /* vec_vcmpgtsw */ 2328 2329 static __inline__ vector bool int __attribute__((__always_inline__)) 2330 vec_vcmpgtsw(vector int __a, vector int __b) { 2331 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2332 } 2333 2334 /* vec_vcmpgtuw */ 2335 2336 static __inline__ vector bool int __attribute__((__always_inline__)) 2337 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2338 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2339 } 2340 2341 /* vec_vcmpgtfp */ 2342 2343 static __inline__ vector bool int __attribute__((__always_inline__)) 2344 vec_vcmpgtfp(vector float __a, vector float __b) { 2345 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2346 } 2347 2348 /* vec_cmple */ 2349 2350 static __inline__ vector bool char __ATTRS_o_ai 2351 vec_cmple(vector signed char __a, vector signed char __b) { 2352 return vec_cmpge(__b, __a); 2353 } 2354 2355 static __inline__ vector bool char __ATTRS_o_ai 2356 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2357 return vec_cmpge(__b, __a); 2358 } 2359 2360 static __inline__ vector bool short __ATTRS_o_ai 2361 vec_cmple(vector signed short __a, vector signed short __b) { 2362 return vec_cmpge(__b, __a); 2363 } 2364 2365 static __inline__ vector bool short __ATTRS_o_ai 2366 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2367 return vec_cmpge(__b, __a); 2368 } 2369 2370 static __inline__ vector bool int __ATTRS_o_ai 2371 vec_cmple(vector signed int __a, vector signed int __b) { 2372 return vec_cmpge(__b, __a); 2373 } 2374 2375 static __inline__ vector bool int __ATTRS_o_ai 2376 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2377 return vec_cmpge(__b, __a); 2378 } 2379 2380 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2381 vector float __b) { 2382 return vec_cmpge(__b, __a); 2383 } 2384 2385 #ifdef __VSX__ 2386 static __inline__ vector bool long long __ATTRS_o_ai 2387 vec_cmple(vector double __a, vector double __b) { 2388 return vec_cmpge(__b, __a); 2389 } 2390 2391 static __inline__ vector bool long long __ATTRS_o_ai 2392 vec_cmple(vector signed long long __a, vector signed long long __b) { 2393 return vec_cmpge(__b, __a); 2394 } 2395 2396 static __inline__ vector bool long long __ATTRS_o_ai 2397 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2398 return vec_cmpge(__b, __a); 2399 } 2400 #endif 2401 2402 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2403 static __inline__ vector bool __int128 __ATTRS_o_ai 2404 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { 2405 return vec_cmpge(__b, __a); 2406 } 2407 2408 static __inline__ vector bool __int128 __ATTRS_o_ai 2409 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2410 return vec_cmpge(__b, __a); 2411 } 2412 #endif 2413 2414 /* vec_cmplt */ 2415 2416 static __inline__ vector bool char __ATTRS_o_ai 2417 vec_cmplt(vector signed char __a, vector signed char __b) { 2418 return vec_cmpgt(__b, __a); 2419 } 2420 2421 static __inline__ vector bool char __ATTRS_o_ai 2422 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2423 return vec_cmpgt(__b, __a); 2424 } 2425 2426 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2427 vector short __b) { 2428 return vec_cmpgt(__b, __a); 2429 } 2430 2431 static __inline__ vector bool short __ATTRS_o_ai 2432 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2433 return vec_cmpgt(__b, __a); 2434 } 2435 2436 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2437 vector int __b) { 2438 return vec_cmpgt(__b, __a); 2439 } 2440 2441 static __inline__ vector bool int __ATTRS_o_ai 2442 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2443 return vec_cmpgt(__b, __a); 2444 } 2445 2446 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2447 vector float __b) { 2448 return vec_cmpgt(__b, __a); 2449 } 2450 2451 #ifdef __VSX__ 2452 static __inline__ vector bool long long __ATTRS_o_ai 2453 vec_cmplt(vector double __a, vector double __b) { 2454 return vec_cmpgt(__b, __a); 2455 } 2456 #endif 2457 2458 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2459 static __inline__ vector bool __int128 __ATTRS_o_ai 2460 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { 2461 return vec_cmpgt(__b, __a); 2462 } 2463 2464 static __inline__ vector bool __int128 __ATTRS_o_ai 2465 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2466 return vec_cmpgt(__b, __a); 2467 } 2468 #endif 2469 2470 #ifdef __VSX__ 2471 static __inline__ vector bool long long __ATTRS_o_ai 2472 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2473 return vec_cmpgt(__b, __a); 2474 } 2475 2476 static __inline__ vector bool long long __ATTRS_o_ai 2477 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2478 return vec_cmpgt(__b, __a); 2479 } 2480 #endif 2481 2482 #ifdef __POWER8_VECTOR__ 2483 /* vec_popcnt */ 2484 2485 static __inline__ vector unsigned char __ATTRS_o_ai 2486 vec_popcnt(vector signed char __a) { 2487 return __builtin_altivec_vpopcntb(__a); 2488 } 2489 static __inline__ vector unsigned char __ATTRS_o_ai 2490 vec_popcnt(vector unsigned char __a) { 2491 return __builtin_altivec_vpopcntb(__a); 2492 } 2493 static __inline__ vector unsigned short __ATTRS_o_ai 2494 vec_popcnt(vector signed short __a) { 2495 return __builtin_altivec_vpopcnth(__a); 2496 } 2497 static __inline__ vector unsigned short __ATTRS_o_ai 2498 vec_popcnt(vector unsigned short __a) { 2499 return __builtin_altivec_vpopcnth(__a); 2500 } 2501 static __inline__ vector unsigned int __ATTRS_o_ai 2502 vec_popcnt(vector signed int __a) { 2503 return __builtin_altivec_vpopcntw(__a); 2504 } 2505 static __inline__ vector unsigned int __ATTRS_o_ai 2506 vec_popcnt(vector unsigned int __a) { 2507 return __builtin_altivec_vpopcntw(__a); 2508 } 2509 static __inline__ vector unsigned long long __ATTRS_o_ai 2510 vec_popcnt(vector signed long long __a) { 2511 return __builtin_altivec_vpopcntd(__a); 2512 } 2513 static __inline__ vector unsigned long long __ATTRS_o_ai 2514 vec_popcnt(vector unsigned long long __a) { 2515 return __builtin_altivec_vpopcntd(__a); 2516 } 2517 2518 #define vec_vclz vec_cntlz 2519 /* vec_cntlz */ 2520 2521 static __inline__ vector signed char __ATTRS_o_ai 2522 vec_cntlz(vector signed char __a) { 2523 return __builtin_altivec_vclzb(__a); 2524 } 2525 static __inline__ vector unsigned char __ATTRS_o_ai 2526 vec_cntlz(vector unsigned char __a) { 2527 return __builtin_altivec_vclzb(__a); 2528 } 2529 static __inline__ vector signed short __ATTRS_o_ai 2530 vec_cntlz(vector signed short __a) { 2531 return __builtin_altivec_vclzh(__a); 2532 } 2533 static __inline__ vector unsigned short __ATTRS_o_ai 2534 vec_cntlz(vector unsigned short __a) { 2535 return __builtin_altivec_vclzh(__a); 2536 } 2537 static __inline__ vector signed int __ATTRS_o_ai 2538 vec_cntlz(vector signed int __a) { 2539 return __builtin_altivec_vclzw(__a); 2540 } 2541 static __inline__ vector unsigned int __ATTRS_o_ai 2542 vec_cntlz(vector unsigned int __a) { 2543 return __builtin_altivec_vclzw(__a); 2544 } 2545 static __inline__ vector signed long long __ATTRS_o_ai 2546 vec_cntlz(vector signed long long __a) { 2547 return __builtin_altivec_vclzd(__a); 2548 } 2549 static __inline__ vector unsigned long long __ATTRS_o_ai 2550 vec_cntlz(vector unsigned long long __a) { 2551 return __builtin_altivec_vclzd(__a); 2552 } 2553 #endif 2554 2555 #ifdef __POWER9_VECTOR__ 2556 2557 /* vec_cnttz */ 2558 2559 static __inline__ vector signed char __ATTRS_o_ai 2560 vec_cnttz(vector signed char __a) { 2561 return __builtin_altivec_vctzb(__a); 2562 } 2563 static __inline__ vector unsigned char __ATTRS_o_ai 2564 vec_cnttz(vector unsigned char __a) { 2565 return __builtin_altivec_vctzb(__a); 2566 } 2567 static __inline__ vector signed short __ATTRS_o_ai 2568 vec_cnttz(vector signed short __a) { 2569 return __builtin_altivec_vctzh(__a); 2570 } 2571 static __inline__ vector unsigned short __ATTRS_o_ai 2572 vec_cnttz(vector unsigned short __a) { 2573 return __builtin_altivec_vctzh(__a); 2574 } 2575 static __inline__ vector signed int __ATTRS_o_ai 2576 vec_cnttz(vector signed int __a) { 2577 return __builtin_altivec_vctzw(__a); 2578 } 2579 static __inline__ vector unsigned int __ATTRS_o_ai 2580 vec_cnttz(vector unsigned int __a) { 2581 return __builtin_altivec_vctzw(__a); 2582 } 2583 static __inline__ vector signed long long __ATTRS_o_ai 2584 vec_cnttz(vector signed long long __a) { 2585 return __builtin_altivec_vctzd(__a); 2586 } 2587 static __inline__ vector unsigned long long __ATTRS_o_ai 2588 vec_cnttz(vector unsigned long long __a) { 2589 return __builtin_altivec_vctzd(__a); 2590 } 2591 2592 /* vec_first_match_index */ 2593 2594 static __inline__ unsigned __ATTRS_o_ai 2595 vec_first_match_index(vector signed char __a, vector signed char __b) { 2596 vector unsigned long long __res = 2597 #ifdef __LITTLE_ENDIAN__ 2598 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2599 #else 2600 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2601 #endif 2602 if (__res[0] == 64) { 2603 return (__res[1] + 64) >> 3; 2604 } 2605 return __res[0] >> 3; 2606 } 2607 2608 static __inline__ unsigned __ATTRS_o_ai 2609 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2610 vector unsigned long long __res = 2611 #ifdef __LITTLE_ENDIAN__ 2612 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2613 #else 2614 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2615 #endif 2616 if (__res[0] == 64) { 2617 return (__res[1] + 64) >> 3; 2618 } 2619 return __res[0] >> 3; 2620 } 2621 2622 static __inline__ unsigned __ATTRS_o_ai 2623 vec_first_match_index(vector signed short __a, vector signed short __b) { 2624 vector unsigned long long __res = 2625 #ifdef __LITTLE_ENDIAN__ 2626 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2627 #else 2628 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2629 #endif 2630 if (__res[0] == 64) { 2631 return (__res[1] + 64) >> 4; 2632 } 2633 return __res[0] >> 4; 2634 } 2635 2636 static __inline__ unsigned __ATTRS_o_ai 2637 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2638 vector unsigned long long __res = 2639 #ifdef __LITTLE_ENDIAN__ 2640 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2641 #else 2642 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2643 #endif 2644 if (__res[0] == 64) { 2645 return (__res[1] + 64) >> 4; 2646 } 2647 return __res[0] >> 4; 2648 } 2649 2650 static __inline__ unsigned __ATTRS_o_ai 2651 vec_first_match_index(vector signed int __a, vector signed int __b) { 2652 vector unsigned long long __res = 2653 #ifdef __LITTLE_ENDIAN__ 2654 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2655 #else 2656 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2657 #endif 2658 if (__res[0] == 64) { 2659 return (__res[1] + 64) >> 5; 2660 } 2661 return __res[0] >> 5; 2662 } 2663 2664 static __inline__ unsigned __ATTRS_o_ai 2665 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2666 vector unsigned long long __res = 2667 #ifdef __LITTLE_ENDIAN__ 2668 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2669 #else 2670 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2671 #endif 2672 if (__res[0] == 64) { 2673 return (__res[1] + 64) >> 5; 2674 } 2675 return __res[0] >> 5; 2676 } 2677 2678 /* vec_first_match_or_eos_index */ 2679 2680 static __inline__ unsigned __ATTRS_o_ai 2681 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2682 /* Compare the result of the comparison of two vectors with either and OR the 2683 result. Either the elements are equal or one will equal the comparison 2684 result if either is zero. 2685 */ 2686 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2687 vector bool char __tmp2 = __tmp1 | 2688 vec_cmpeq((vector signed char)__tmp1, __a) | 2689 vec_cmpeq((vector signed char)__tmp1, __b); 2690 2691 vector unsigned long long __res = 2692 #ifdef __LITTLE_ENDIAN__ 2693 vec_cnttz((vector unsigned long long)__tmp2); 2694 #else 2695 vec_cntlz((vector unsigned long long)__tmp2); 2696 #endif 2697 if (__res[0] == 64) { 2698 return (__res[1] + 64) >> 3; 2699 } 2700 return __res[0] >> 3; 2701 } 2702 2703 static __inline__ unsigned __ATTRS_o_ai 2704 vec_first_match_or_eos_index(vector unsigned char __a, 2705 vector unsigned char __b) { 2706 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2707 vector bool char __tmp2 = __tmp1 | 2708 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2709 vec_cmpeq((vector unsigned char)__tmp1, __b); 2710 2711 vector unsigned long long __res = 2712 #ifdef __LITTLE_ENDIAN__ 2713 vec_cnttz((vector unsigned long long)__tmp2); 2714 #else 2715 vec_cntlz((vector unsigned long long)__tmp2); 2716 #endif 2717 if (__res[0] == 64) { 2718 return (__res[1] + 64) >> 3; 2719 } 2720 return __res[0] >> 3; 2721 } 2722 2723 static __inline__ unsigned __ATTRS_o_ai 2724 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2725 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2726 vector bool short __tmp2 = __tmp1 | 2727 vec_cmpeq((vector signed short)__tmp1, __a) | 2728 vec_cmpeq((vector signed short)__tmp1, __b); 2729 2730 vector unsigned long long __res = 2731 #ifdef __LITTLE_ENDIAN__ 2732 vec_cnttz((vector unsigned long long)__tmp2); 2733 #else 2734 vec_cntlz((vector unsigned long long)__tmp2); 2735 #endif 2736 if (__res[0] == 64) { 2737 return (__res[1] + 64) >> 4; 2738 } 2739 return __res[0] >> 4; 2740 } 2741 2742 static __inline__ unsigned __ATTRS_o_ai 2743 vec_first_match_or_eos_index(vector unsigned short __a, 2744 vector unsigned short __b) { 2745 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2746 vector bool short __tmp2 = __tmp1 | 2747 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2748 vec_cmpeq((vector unsigned short)__tmp1, __b); 2749 2750 vector unsigned long long __res = 2751 #ifdef __LITTLE_ENDIAN__ 2752 vec_cnttz((vector unsigned long long)__tmp2); 2753 #else 2754 vec_cntlz((vector unsigned long long)__tmp2); 2755 #endif 2756 if (__res[0] == 64) { 2757 return (__res[1] + 64) >> 4; 2758 } 2759 return __res[0] >> 4; 2760 } 2761 2762 static __inline__ unsigned __ATTRS_o_ai 2763 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2764 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2765 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2766 vec_cmpeq((vector signed int)__tmp1, __b); 2767 2768 vector unsigned long long __res = 2769 #ifdef __LITTLE_ENDIAN__ 2770 vec_cnttz((vector unsigned long long)__tmp2); 2771 #else 2772 vec_cntlz((vector unsigned long long)__tmp2); 2773 #endif 2774 if (__res[0] == 64) { 2775 return (__res[1] + 64) >> 5; 2776 } 2777 return __res[0] >> 5; 2778 } 2779 2780 static __inline__ unsigned __ATTRS_o_ai 2781 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2782 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2783 vector bool int __tmp2 = __tmp1 | 2784 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2785 vec_cmpeq((vector unsigned int)__tmp1, __b); 2786 2787 vector unsigned long long __res = 2788 #ifdef __LITTLE_ENDIAN__ 2789 vec_cnttz((vector unsigned long long)__tmp2); 2790 #else 2791 vec_cntlz((vector unsigned long long)__tmp2); 2792 #endif 2793 if (__res[0] == 64) { 2794 return (__res[1] + 64) >> 5; 2795 } 2796 return __res[0] >> 5; 2797 } 2798 2799 /* vec_first_mismatch_index */ 2800 2801 static __inline__ unsigned __ATTRS_o_ai 2802 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2803 vector unsigned long long __res = 2804 #ifdef __LITTLE_ENDIAN__ 2805 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2806 #else 2807 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2808 #endif 2809 if (__res[0] == 64) { 2810 return (__res[1] + 64) >> 3; 2811 } 2812 return __res[0] >> 3; 2813 } 2814 2815 static __inline__ unsigned __ATTRS_o_ai 2816 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2817 vector unsigned long long __res = 2818 #ifdef __LITTLE_ENDIAN__ 2819 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2820 #else 2821 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2822 #endif 2823 if (__res[0] == 64) { 2824 return (__res[1] + 64) >> 3; 2825 } 2826 return __res[0] >> 3; 2827 } 2828 2829 static __inline__ unsigned __ATTRS_o_ai 2830 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2831 vector unsigned long long __res = 2832 #ifdef __LITTLE_ENDIAN__ 2833 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2834 #else 2835 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2836 #endif 2837 if (__res[0] == 64) { 2838 return (__res[1] + 64) >> 4; 2839 } 2840 return __res[0] >> 4; 2841 } 2842 2843 static __inline__ unsigned __ATTRS_o_ai 2844 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2845 vector unsigned long long __res = 2846 #ifdef __LITTLE_ENDIAN__ 2847 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2848 #else 2849 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2850 #endif 2851 if (__res[0] == 64) { 2852 return (__res[1] + 64) >> 4; 2853 } 2854 return __res[0] >> 4; 2855 } 2856 2857 static __inline__ unsigned __ATTRS_o_ai 2858 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2859 vector unsigned long long __res = 2860 #ifdef __LITTLE_ENDIAN__ 2861 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2862 #else 2863 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2864 #endif 2865 if (__res[0] == 64) { 2866 return (__res[1] + 64) >> 5; 2867 } 2868 return __res[0] >> 5; 2869 } 2870 2871 static __inline__ unsigned __ATTRS_o_ai 2872 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2873 vector unsigned long long __res = 2874 #ifdef __LITTLE_ENDIAN__ 2875 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2876 #else 2877 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2878 #endif 2879 if (__res[0] == 64) { 2880 return (__res[1] + 64) >> 5; 2881 } 2882 return __res[0] >> 5; 2883 } 2884 2885 /* vec_first_mismatch_or_eos_index */ 2886 2887 static __inline__ unsigned __ATTRS_o_ai 2888 vec_first_mismatch_or_eos_index(vector signed char __a, 2889 vector signed char __b) { 2890 vector unsigned long long __res = 2891 #ifdef __LITTLE_ENDIAN__ 2892 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2893 #else 2894 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2895 #endif 2896 if (__res[0] == 64) { 2897 return (__res[1] + 64) >> 3; 2898 } 2899 return __res[0] >> 3; 2900 } 2901 2902 static __inline__ unsigned __ATTRS_o_ai 2903 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2904 vector unsigned char __b) { 2905 vector unsigned long long __res = 2906 #ifdef __LITTLE_ENDIAN__ 2907 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2908 #else 2909 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2910 #endif 2911 if (__res[0] == 64) { 2912 return (__res[1] + 64) >> 3; 2913 } 2914 return __res[0] >> 3; 2915 } 2916 2917 static __inline__ unsigned __ATTRS_o_ai 2918 vec_first_mismatch_or_eos_index(vector signed short __a, 2919 vector signed short __b) { 2920 vector unsigned long long __res = 2921 #ifdef __LITTLE_ENDIAN__ 2922 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2923 #else 2924 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2925 #endif 2926 if (__res[0] == 64) { 2927 return (__res[1] + 64) >> 4; 2928 } 2929 return __res[0] >> 4; 2930 } 2931 2932 static __inline__ unsigned __ATTRS_o_ai 2933 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2934 vector unsigned short __b) { 2935 vector unsigned long long __res = 2936 #ifdef __LITTLE_ENDIAN__ 2937 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2938 #else 2939 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2940 #endif 2941 if (__res[0] == 64) { 2942 return (__res[1] + 64) >> 4; 2943 } 2944 return __res[0] >> 4; 2945 } 2946 2947 static __inline__ unsigned __ATTRS_o_ai 2948 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2949 vector unsigned long long __res = 2950 #ifdef __LITTLE_ENDIAN__ 2951 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2952 #else 2953 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2954 #endif 2955 if (__res[0] == 64) { 2956 return (__res[1] + 64) >> 5; 2957 } 2958 return __res[0] >> 5; 2959 } 2960 2961 static __inline__ unsigned __ATTRS_o_ai 2962 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2963 vector unsigned int __b) { 2964 vector unsigned long long __res = 2965 #ifdef __LITTLE_ENDIAN__ 2966 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2967 #else 2968 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2969 #endif 2970 if (__res[0] == 64) { 2971 return (__res[1] + 64) >> 5; 2972 } 2973 return __res[0] >> 5; 2974 } 2975 2976 static __inline__ vector double __ATTRS_o_ai 2977 vec_insert_exp(vector double __a, vector unsigned long long __b) { 2978 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 2979 } 2980 2981 static __inline__ vector double __ATTRS_o_ai 2982 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 2983 return __builtin_vsx_xviexpdp(__a,__b); 2984 } 2985 2986 static __inline__ vector float __ATTRS_o_ai 2987 vec_insert_exp(vector float __a, vector unsigned int __b) { 2988 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 2989 } 2990 2991 static __inline__ vector float __ATTRS_o_ai 2992 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 2993 return __builtin_vsx_xviexpsp(__a,__b); 2994 } 2995 2996 #if defined(__powerpc64__) 2997 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 2998 size_t __b) { 2999 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 3000 } 3001 3002 static __inline__ vector unsigned char __ATTRS_o_ai 3003 vec_xl_len(const unsigned char *__a, size_t __b) { 3004 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 3005 } 3006 3007 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 3008 size_t __b) { 3009 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 3010 } 3011 3012 static __inline__ vector unsigned short __ATTRS_o_ai 3013 vec_xl_len(const unsigned short *__a, size_t __b) { 3014 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 3015 } 3016 3017 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 3018 size_t __b) { 3019 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 3020 } 3021 3022 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 3023 size_t __b) { 3024 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 3025 } 3026 3027 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 3028 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 3029 } 3030 3031 #ifdef __SIZEOF_INT128__ 3032 static __inline__ vector signed __int128 __ATTRS_o_ai 3033 vec_xl_len(const signed __int128 *__a, size_t __b) { 3034 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3035 } 3036 3037 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3038 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 3039 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3040 } 3041 #endif 3042 3043 static __inline__ vector signed long long __ATTRS_o_ai 3044 vec_xl_len(const signed long long *__a, size_t __b) { 3045 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3046 } 3047 3048 static __inline__ vector unsigned long long __ATTRS_o_ai 3049 vec_xl_len(const unsigned long long *__a, size_t __b) { 3050 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3051 } 3052 3053 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 3054 size_t __b) { 3055 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 3056 } 3057 3058 static __inline__ vector unsigned char __ATTRS_o_ai 3059 vec_xl_len_r(const unsigned char *__a, size_t __b) { 3060 vector unsigned char __res = 3061 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 3062 vector unsigned char __mask = 3063 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 3064 return (vector unsigned char)__builtin_altivec_vperm_4si( 3065 (vector int)__res, (vector int)__res, __mask); 3066 } 3067 3068 // vec_xst_len 3069 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 3070 unsigned char *__b, 3071 size_t __c) { 3072 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3073 } 3074 3075 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, 3076 signed char *__b, size_t __c) { 3077 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3078 } 3079 3080 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a, 3081 signed short *__b, size_t __c) { 3082 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3083 } 3084 3085 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, 3086 unsigned short *__b, 3087 size_t __c) { 3088 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3089 } 3090 3091 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 3092 signed int *__b, size_t __c) { 3093 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3094 } 3095 3096 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, 3097 unsigned int *__b, size_t __c) { 3098 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3099 } 3100 3101 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, 3102 size_t __c) { 3103 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3104 } 3105 3106 #ifdef __SIZEOF_INT128__ 3107 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 3108 signed __int128 *__b, 3109 size_t __c) { 3110 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3111 } 3112 3113 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, 3114 unsigned __int128 *__b, 3115 size_t __c) { 3116 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3117 } 3118 #endif 3119 3120 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 3121 signed long long *__b, 3122 size_t __c) { 3123 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3124 } 3125 3126 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 3127 unsigned long long *__b, 3128 size_t __c) { 3129 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3130 } 3131 3132 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, 3133 size_t __c) { 3134 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3135 } 3136 3137 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, 3138 unsigned char *__b, 3139 size_t __c) { 3140 vector unsigned char __mask = 3141 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 3142 vector unsigned char __res = 3143 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); 3144 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 3145 } 3146 #endif 3147 #endif 3148 3149 #if defined(__POWER9_VECTOR__) && defined(__powerpc64__) 3150 #define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT)) 3151 #define __vec_strmb(PTR, CNT, VAL) \ 3152 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT)) 3153 #else 3154 #define __vec_ldrmb __builtin_vsx_ldrmb 3155 #define __vec_strmb __builtin_vsx_strmb 3156 #endif 3157 3158 /* vec_cpsgn */ 3159 3160 #ifdef __VSX__ 3161 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 3162 vector float __b) { 3163 return __builtin_vsx_xvcpsgnsp(__b, __a); 3164 } 3165 3166 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 3167 vector double __b) { 3168 return __builtin_vsx_xvcpsgndp(__b, __a); 3169 } 3170 #endif 3171 3172 /* vec_ctf */ 3173 3174 #ifdef __VSX__ 3175 // There are some functions that have different signatures with the XL compiler 3176 // from those in Clang/GCC and documented in the PVIPR. This macro ensures that 3177 // the XL-compatible signatures are used for those functions. 3178 #ifdef __XL_COMPAT_ALTIVEC__ 3179 #define vec_ctf(__a, __b) \ 3180 _Generic((__a), vector int \ 3181 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3182 vector unsigned int \ 3183 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3184 (__b)), \ 3185 vector unsigned long long \ 3186 : (__builtin_vsx_xvcvuxdsp((vector unsigned long long)(__a)) * \ 3187 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \ 3188 vector signed long long \ 3189 : (__builtin_vsx_xvcvsxdsp((vector signed long long)(__a)) * \ 3190 (vector float)(vector unsigned)((0x7f - (__b)) << 23))) 3191 #else // __XL_COMPAT_ALTIVEC__ 3192 #define vec_ctf(__a, __b) \ 3193 _Generic((__a), vector int \ 3194 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3195 vector unsigned int \ 3196 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3197 (__b)), \ 3198 vector unsigned long long \ 3199 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3200 vector double) * \ 3201 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3202 << 52)), \ 3203 vector signed long long \ 3204 : (__builtin_convertvector((vector signed long long)(__a), \ 3205 vector double) * \ 3206 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3207 << 52))) 3208 #endif // __XL_COMPAT_ALTIVEC__ 3209 #else 3210 #define vec_ctf(__a, __b) \ 3211 _Generic((__a), vector int \ 3212 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3213 vector unsigned int \ 3214 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3215 (__b))) 3216 #endif 3217 3218 /* vec_ctd */ 3219 #ifdef __VSX__ 3220 #define vec_ctd(__a, __b) \ 3221 _Generic((__a), vector signed int \ 3222 : (vec_doublee((vector signed int)(__a)) * \ 3223 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3224 << 52)), \ 3225 vector unsigned int \ 3226 : (vec_doublee((vector unsigned int)(__a)) * \ 3227 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3228 << 52)), \ 3229 vector unsigned long long \ 3230 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3231 vector double) * \ 3232 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3233 << 52)), \ 3234 vector signed long long \ 3235 : (__builtin_convertvector((vector signed long long)(__a), \ 3236 vector double) * \ 3237 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3238 << 52))) 3239 #endif // __VSX__ 3240 3241 /* vec_vcfsx */ 3242 3243 #define vec_vcfux __builtin_altivec_vcfux 3244 /* vec_vcfux */ 3245 3246 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 3247 3248 /* vec_cts */ 3249 3250 #ifdef __VSX__ 3251 #ifdef __XL_COMPAT_ALTIVEC__ 3252 #define vec_cts(__a, __b) \ 3253 _Generic((__a), vector float \ 3254 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3255 vector double \ 3256 : __extension__({ \ 3257 vector double __ret = \ 3258 (vector double)(__a) * \ 3259 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3260 << 52); \ 3261 __builtin_vsx_xvcvdpsxws(__ret); \ 3262 })) 3263 #else // __XL_COMPAT_ALTIVEC__ 3264 #define vec_cts(__a, __b) \ 3265 _Generic((__a), vector float \ 3266 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3267 vector double \ 3268 : __extension__({ \ 3269 vector double __ret = \ 3270 (vector double)(__a) * \ 3271 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3272 << 52); \ 3273 __builtin_convertvector(__ret, vector signed long long); \ 3274 })) 3275 #endif // __XL_COMPAT_ALTIVEC__ 3276 #else 3277 #define vec_cts __builtin_altivec_vctsxs 3278 #endif 3279 3280 /* vec_vctsxs */ 3281 3282 #define vec_vctsxs __builtin_altivec_vctsxs 3283 3284 /* vec_ctu */ 3285 3286 #ifdef __VSX__ 3287 #ifdef __XL_COMPAT_ALTIVEC__ 3288 #define vec_ctu(__a, __b) \ 3289 _Generic((__a), vector float \ 3290 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3291 vector double \ 3292 : __extension__({ \ 3293 vector double __ret = \ 3294 (vector double)(__a) * \ 3295 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3296 << 52); \ 3297 __builtin_vsx_xvcvdpuxws(__ret); \ 3298 })) 3299 #else // __XL_COMPAT_ALTIVEC__ 3300 #define vec_ctu(__a, __b) \ 3301 _Generic((__a), vector float \ 3302 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3303 vector double \ 3304 : __extension__({ \ 3305 vector double __ret = \ 3306 (vector double)(__a) * \ 3307 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3308 << 52); \ 3309 __builtin_convertvector(__ret, vector unsigned long long); \ 3310 })) 3311 #endif // __XL_COMPAT_ALTIVEC__ 3312 #else 3313 #define vec_ctu __builtin_altivec_vctuxs 3314 #endif 3315 3316 #ifdef __LITTLE_ENDIAN__ 3317 /* vec_ctsl */ 3318 3319 #ifdef __VSX__ 3320 #define vec_ctsl(__a, __b) \ 3321 _Generic((__a), vector float \ 3322 : __extension__({ \ 3323 vector float __ret = \ 3324 (vector float)(__a) * \ 3325 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3326 __builtin_vsx_xvcvspsxds( \ 3327 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3328 }), \ 3329 vector double \ 3330 : __extension__({ \ 3331 vector double __ret = \ 3332 (vector double)(__a) * \ 3333 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3334 << 52); \ 3335 __builtin_convertvector(__ret, vector signed long long); \ 3336 })) 3337 3338 /* vec_ctul */ 3339 3340 #define vec_ctul(__a, __b) \ 3341 _Generic((__a), vector float \ 3342 : __extension__({ \ 3343 vector float __ret = \ 3344 (vector float)(__a) * \ 3345 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3346 __builtin_vsx_xvcvspuxds( \ 3347 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3348 }), \ 3349 vector double \ 3350 : __extension__({ \ 3351 vector double __ret = \ 3352 (vector double)(__a) * \ 3353 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3354 << 52); \ 3355 __builtin_convertvector(__ret, vector unsigned long long); \ 3356 })) 3357 #endif 3358 #else // __LITTLE_ENDIAN__ 3359 /* vec_ctsl */ 3360 3361 #ifdef __VSX__ 3362 #define vec_ctsl(__a, __b) \ 3363 _Generic((__a), vector float \ 3364 : __extension__({ \ 3365 vector float __ret = \ 3366 (vector float)(__a) * \ 3367 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3368 __builtin_vsx_xvcvspsxds(__ret); \ 3369 }), \ 3370 vector double \ 3371 : __extension__({ \ 3372 vector double __ret = \ 3373 (vector double)(__a) * \ 3374 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3375 << 52); \ 3376 __builtin_convertvector(__ret, vector signed long long); \ 3377 })) 3378 3379 /* vec_ctul */ 3380 3381 #define vec_ctul(__a, __b) \ 3382 _Generic((__a), vector float \ 3383 : __extension__({ \ 3384 vector float __ret = \ 3385 (vector float)(__a) * \ 3386 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3387 __builtin_vsx_xvcvspuxds(__ret); \ 3388 }), \ 3389 vector double \ 3390 : __extension__({ \ 3391 vector double __ret = \ 3392 (vector double)(__a) * \ 3393 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3394 << 52); \ 3395 __builtin_convertvector(__ret, vector unsigned long long); \ 3396 })) 3397 #endif 3398 #endif // __LITTLE_ENDIAN__ 3399 3400 /* vec_vctuxs */ 3401 3402 #define vec_vctuxs __builtin_altivec_vctuxs 3403 3404 /* vec_signext */ 3405 3406 #ifdef __POWER9_VECTOR__ 3407 static __inline__ vector signed int __ATTRS_o_ai 3408 vec_signexti(vector signed char __a) { 3409 return __builtin_altivec_vextsb2w(__a); 3410 } 3411 3412 static __inline__ vector signed int __ATTRS_o_ai 3413 vec_signexti(vector signed short __a) { 3414 return __builtin_altivec_vextsh2w(__a); 3415 } 3416 3417 static __inline__ vector signed long long __ATTRS_o_ai 3418 vec_signextll(vector signed char __a) { 3419 return __builtin_altivec_vextsb2d(__a); 3420 } 3421 3422 static __inline__ vector signed long long __ATTRS_o_ai 3423 vec_signextll(vector signed short __a) { 3424 return __builtin_altivec_vextsh2d(__a); 3425 } 3426 3427 static __inline__ vector signed long long __ATTRS_o_ai 3428 vec_signextll(vector signed int __a) { 3429 return __builtin_altivec_vextsw2d(__a); 3430 } 3431 #endif 3432 3433 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3434 static __inline__ vector signed __int128 __ATTRS_o_ai 3435 vec_signextq(vector signed long long __a) { 3436 return __builtin_altivec_vextsd2q(__a); 3437 } 3438 #endif 3439 3440 /* vec_signed */ 3441 3442 static __inline__ vector signed int __ATTRS_o_ai 3443 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3444 3445 static __inline__ vector signed int __ATTRS_o_ai 3446 vec_signed(vector float __a) { 3447 return __builtin_convertvector(__a, vector signed int); 3448 } 3449 3450 #ifdef __VSX__ 3451 static __inline__ vector signed long long __ATTRS_o_ai 3452 vec_signed(vector double __a) { 3453 return __builtin_convertvector(__a, vector signed long long); 3454 } 3455 3456 static __inline__ vector signed int __attribute__((__always_inline__)) 3457 vec_signed2(vector double __a, vector double __b) { 3458 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3459 } 3460 3461 static __inline__ vector signed int __ATTRS_o_ai 3462 vec_signede(vector double __a) { 3463 #ifdef __LITTLE_ENDIAN__ 3464 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3465 return vec_sld(__ret, __ret, 12); 3466 #else 3467 return __builtin_vsx_xvcvdpsxws(__a); 3468 #endif 3469 } 3470 3471 static __inline__ vector signed int __ATTRS_o_ai 3472 vec_signedo(vector double __a) { 3473 #ifdef __LITTLE_ENDIAN__ 3474 return __builtin_vsx_xvcvdpsxws(__a); 3475 #else 3476 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3477 return vec_sld(__ret, __ret, 12); 3478 #endif 3479 } 3480 #endif 3481 3482 /* vec_unsigned */ 3483 3484 static __inline__ vector unsigned int __ATTRS_o_ai 3485 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3486 3487 static __inline__ vector unsigned int __ATTRS_o_ai 3488 vec_unsigned(vector float __a) { 3489 return __builtin_convertvector(__a, vector unsigned int); 3490 } 3491 3492 #ifdef __VSX__ 3493 static __inline__ vector unsigned long long __ATTRS_o_ai 3494 vec_unsigned(vector double __a) { 3495 return __builtin_convertvector(__a, vector unsigned long long); 3496 } 3497 3498 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3499 vec_unsigned2(vector double __a, vector double __b) { 3500 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3501 } 3502 3503 static __inline__ vector unsigned int __ATTRS_o_ai 3504 vec_unsignede(vector double __a) { 3505 #ifdef __LITTLE_ENDIAN__ 3506 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3507 return vec_sld(__ret, __ret, 12); 3508 #else 3509 return __builtin_vsx_xvcvdpuxws(__a); 3510 #endif 3511 } 3512 3513 static __inline__ vector unsigned int __ATTRS_o_ai 3514 vec_unsignedo(vector double __a) { 3515 #ifdef __LITTLE_ENDIAN__ 3516 return __builtin_vsx_xvcvdpuxws(__a); 3517 #else 3518 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3519 return vec_sld(__ret, __ret, 12); 3520 #endif 3521 } 3522 #endif 3523 3524 /* vec_float */ 3525 3526 static __inline__ vector float __ATTRS_o_ai 3527 vec_sld(vector float, vector float, unsigned const int __c); 3528 3529 static __inline__ vector float __ATTRS_o_ai 3530 vec_float(vector signed int __a) { 3531 return __builtin_convertvector(__a, vector float); 3532 } 3533 3534 static __inline__ vector float __ATTRS_o_ai 3535 vec_float(vector unsigned int __a) { 3536 return __builtin_convertvector(__a, vector float); 3537 } 3538 3539 #ifdef __VSX__ 3540 static __inline__ vector float __ATTRS_o_ai 3541 vec_float2(vector signed long long __a, vector signed long long __b) { 3542 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3543 } 3544 3545 static __inline__ vector float __ATTRS_o_ai 3546 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3547 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3548 } 3549 3550 static __inline__ vector float __ATTRS_o_ai 3551 vec_float2(vector double __a, vector double __b) { 3552 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3553 } 3554 3555 static __inline__ vector float __ATTRS_o_ai 3556 vec_floate(vector signed long long __a) { 3557 #ifdef __LITTLE_ENDIAN__ 3558 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3559 return vec_sld(__ret, __ret, 12); 3560 #else 3561 return __builtin_vsx_xvcvsxdsp(__a); 3562 #endif 3563 } 3564 3565 static __inline__ vector float __ATTRS_o_ai 3566 vec_floate(vector unsigned long long __a) { 3567 #ifdef __LITTLE_ENDIAN__ 3568 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3569 return vec_sld(__ret, __ret, 12); 3570 #else 3571 return __builtin_vsx_xvcvuxdsp(__a); 3572 #endif 3573 } 3574 3575 static __inline__ vector float __ATTRS_o_ai 3576 vec_floate(vector double __a) { 3577 #ifdef __LITTLE_ENDIAN__ 3578 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3579 return vec_sld(__ret, __ret, 12); 3580 #else 3581 return __builtin_vsx_xvcvdpsp(__a); 3582 #endif 3583 } 3584 3585 static __inline__ vector float __ATTRS_o_ai 3586 vec_floato(vector signed long long __a) { 3587 #ifdef __LITTLE_ENDIAN__ 3588 return __builtin_vsx_xvcvsxdsp(__a); 3589 #else 3590 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3591 return vec_sld(__ret, __ret, 12); 3592 #endif 3593 } 3594 3595 static __inline__ vector float __ATTRS_o_ai 3596 vec_floato(vector unsigned long long __a) { 3597 #ifdef __LITTLE_ENDIAN__ 3598 return __builtin_vsx_xvcvuxdsp(__a); 3599 #else 3600 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3601 return vec_sld(__ret, __ret, 12); 3602 #endif 3603 } 3604 3605 static __inline__ vector float __ATTRS_o_ai 3606 vec_floato(vector double __a) { 3607 #ifdef __LITTLE_ENDIAN__ 3608 return __builtin_vsx_xvcvdpsp(__a); 3609 #else 3610 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3611 return vec_sld(__ret, __ret, 12); 3612 #endif 3613 } 3614 #endif 3615 3616 /* vec_double */ 3617 3618 #ifdef __VSX__ 3619 static __inline__ vector double __ATTRS_o_ai 3620 vec_double(vector signed long long __a) { 3621 return __builtin_convertvector(__a, vector double); 3622 } 3623 3624 static __inline__ vector double __ATTRS_o_ai 3625 vec_double(vector unsigned long long __a) { 3626 return __builtin_convertvector(__a, vector double); 3627 } 3628 3629 static __inline__ vector double __ATTRS_o_ai 3630 vec_doublee(vector signed int __a) { 3631 #ifdef __LITTLE_ENDIAN__ 3632 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3633 #else 3634 return __builtin_vsx_xvcvsxwdp(__a); 3635 #endif 3636 } 3637 3638 static __inline__ vector double __ATTRS_o_ai 3639 vec_doublee(vector unsigned int __a) { 3640 #ifdef __LITTLE_ENDIAN__ 3641 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3642 #else 3643 return __builtin_vsx_xvcvuxwdp(__a); 3644 #endif 3645 } 3646 3647 static __inline__ vector double __ATTRS_o_ai 3648 vec_doublee(vector float __a) { 3649 #ifdef __LITTLE_ENDIAN__ 3650 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3651 #else 3652 return __builtin_vsx_xvcvspdp(__a); 3653 #endif 3654 } 3655 3656 static __inline__ vector double __ATTRS_o_ai 3657 vec_doubleh(vector signed int __a) { 3658 vector double __ret = {__a[0], __a[1]}; 3659 return __ret; 3660 } 3661 3662 static __inline__ vector double __ATTRS_o_ai 3663 vec_doubleh(vector unsigned int __a) { 3664 vector double __ret = {__a[0], __a[1]}; 3665 return __ret; 3666 } 3667 3668 static __inline__ vector double __ATTRS_o_ai 3669 vec_doubleh(vector float __a) { 3670 vector double __ret = {__a[0], __a[1]}; 3671 return __ret; 3672 } 3673 3674 static __inline__ vector double __ATTRS_o_ai 3675 vec_doublel(vector signed int __a) { 3676 vector double __ret = {__a[2], __a[3]}; 3677 return __ret; 3678 } 3679 3680 static __inline__ vector double __ATTRS_o_ai 3681 vec_doublel(vector unsigned int __a) { 3682 vector double __ret = {__a[2], __a[3]}; 3683 return __ret; 3684 } 3685 3686 static __inline__ vector double __ATTRS_o_ai 3687 vec_doublel(vector float __a) { 3688 vector double __ret = {__a[2], __a[3]}; 3689 return __ret; 3690 } 3691 3692 static __inline__ vector double __ATTRS_o_ai 3693 vec_doubleo(vector signed int __a) { 3694 #ifdef __LITTLE_ENDIAN__ 3695 return __builtin_vsx_xvcvsxwdp(__a); 3696 #else 3697 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3698 #endif 3699 } 3700 3701 static __inline__ vector double __ATTRS_o_ai 3702 vec_doubleo(vector unsigned int __a) { 3703 #ifdef __LITTLE_ENDIAN__ 3704 return __builtin_vsx_xvcvuxwdp(__a); 3705 #else 3706 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3707 #endif 3708 } 3709 3710 static __inline__ vector double __ATTRS_o_ai 3711 vec_doubleo(vector float __a) { 3712 #ifdef __LITTLE_ENDIAN__ 3713 return __builtin_vsx_xvcvspdp(__a); 3714 #else 3715 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3716 #endif 3717 } 3718 3719 /* vec_cvf */ 3720 static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) { 3721 return vec_doublee(__a); 3722 } 3723 3724 static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) { 3725 return vec_floate(__a); 3726 } 3727 #endif 3728 3729 /* vec_div */ 3730 3731 /* Integer vector divides (vectors are scalarized, elements divided 3732 and the vectors reassembled). 3733 */ 3734 static __inline__ vector signed char __ATTRS_o_ai 3735 vec_div(vector signed char __a, vector signed char __b) { 3736 return __a / __b; 3737 } 3738 3739 static __inline__ vector unsigned char __ATTRS_o_ai 3740 vec_div(vector unsigned char __a, vector unsigned char __b) { 3741 return __a / __b; 3742 } 3743 3744 static __inline__ vector signed short __ATTRS_o_ai 3745 vec_div(vector signed short __a, vector signed short __b) { 3746 return __a / __b; 3747 } 3748 3749 static __inline__ vector unsigned short __ATTRS_o_ai 3750 vec_div(vector unsigned short __a, vector unsigned short __b) { 3751 return __a / __b; 3752 } 3753 3754 static __inline__ vector signed int __ATTRS_o_ai 3755 vec_div(vector signed int __a, vector signed int __b) { 3756 return __a / __b; 3757 } 3758 3759 static __inline__ vector unsigned int __ATTRS_o_ai 3760 vec_div(vector unsigned int __a, vector unsigned int __b) { 3761 return __a / __b; 3762 } 3763 3764 #ifdef __VSX__ 3765 static __inline__ vector signed long long __ATTRS_o_ai 3766 vec_div(vector signed long long __a, vector signed long long __b) { 3767 return __a / __b; 3768 } 3769 3770 static __inline__ vector unsigned long long __ATTRS_o_ai 3771 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3772 return __a / __b; 3773 } 3774 3775 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3776 vector float __b) { 3777 return __a / __b; 3778 } 3779 3780 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3781 vector double __b) { 3782 return __a / __b; 3783 } 3784 #endif 3785 3786 /* vec_dive */ 3787 3788 #ifdef __POWER10_VECTOR__ 3789 static __inline__ vector signed int __ATTRS_o_ai 3790 vec_dive(vector signed int __a, vector signed int __b) { 3791 return __builtin_altivec_vdivesw(__a, __b); 3792 } 3793 3794 static __inline__ vector unsigned int __ATTRS_o_ai 3795 vec_dive(vector unsigned int __a, vector unsigned int __b) { 3796 return __builtin_altivec_vdiveuw(__a, __b); 3797 } 3798 3799 static __inline__ vector signed long long __ATTRS_o_ai 3800 vec_dive(vector signed long long __a, vector signed long long __b) { 3801 return __builtin_altivec_vdivesd(__a, __b); 3802 } 3803 3804 static __inline__ vector unsigned long long __ATTRS_o_ai 3805 vec_dive(vector unsigned long long __a, vector unsigned long long __b) { 3806 return __builtin_altivec_vdiveud(__a, __b); 3807 } 3808 3809 #ifdef __SIZEOF_INT128__ 3810 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3811 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3812 return __builtin_altivec_vdiveuq(__a, __b); 3813 } 3814 3815 static __inline__ vector signed __int128 __ATTRS_o_ai 3816 vec_dive(vector signed __int128 __a, vector signed __int128 __b) { 3817 return __builtin_altivec_vdivesq(__a, __b); 3818 } 3819 #endif 3820 #endif 3821 3822 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3823 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3824 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3825 return __a / __b; 3826 } 3827 3828 static __inline__ vector signed __int128 __ATTRS_o_ai 3829 vec_div(vector signed __int128 __a, vector signed __int128 __b) { 3830 return __a / __b; 3831 } 3832 #endif /* __POWER10_VECTOR__ */ 3833 3834 /* vec_xvtdiv */ 3835 3836 #ifdef __VSX__ 3837 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, 3838 vector double __b) { 3839 return __builtin_vsx_xvtdivdp(__a, __b); 3840 } 3841 3842 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, 3843 vector float __b) { 3844 return __builtin_vsx_xvtdivsp(__a, __b); 3845 } 3846 #endif 3847 3848 /* vec_dss */ 3849 3850 #define vec_dss __builtin_altivec_dss 3851 3852 /* vec_dssall */ 3853 3854 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3855 __builtin_altivec_dssall(); 3856 } 3857 3858 /* vec_dst */ 3859 #define vec_dst(__PTR, __CW, __STR) \ 3860 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) 3861 3862 /* vec_dstst */ 3863 #define vec_dstst(__PTR, __CW, __STR) \ 3864 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) 3865 3866 /* vec_dststt */ 3867 #define vec_dststt(__PTR, __CW, __STR) \ 3868 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) 3869 3870 /* vec_dstt */ 3871 #define vec_dstt(__PTR, __CW, __STR) \ 3872 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) 3873 3874 /* vec_eqv */ 3875 3876 #ifdef __POWER8_VECTOR__ 3877 static __inline__ vector signed char __ATTRS_o_ai 3878 vec_eqv(vector signed char __a, vector signed char __b) { 3879 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3880 (vector unsigned int)__b); 3881 } 3882 3883 static __inline__ vector unsigned char __ATTRS_o_ai 3884 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3885 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3886 (vector unsigned int)__b); 3887 } 3888 3889 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3890 vector bool char __b) { 3891 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3892 (vector unsigned int)__b); 3893 } 3894 3895 static __inline__ vector signed short __ATTRS_o_ai 3896 vec_eqv(vector signed short __a, vector signed short __b) { 3897 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3898 (vector unsigned int)__b); 3899 } 3900 3901 static __inline__ vector unsigned short __ATTRS_o_ai 3902 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3903 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3904 (vector unsigned int)__b); 3905 } 3906 3907 static __inline__ vector bool short __ATTRS_o_ai 3908 vec_eqv(vector bool short __a, vector bool short __b) { 3909 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3910 (vector unsigned int)__b); 3911 } 3912 3913 static __inline__ vector signed int __ATTRS_o_ai 3914 vec_eqv(vector signed int __a, vector signed int __b) { 3915 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3916 (vector unsigned int)__b); 3917 } 3918 3919 static __inline__ vector unsigned int __ATTRS_o_ai 3920 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3921 return __builtin_vsx_xxleqv(__a, __b); 3922 } 3923 3924 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3925 vector bool int __b) { 3926 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3927 (vector unsigned int)__b); 3928 } 3929 3930 static __inline__ vector signed long long __ATTRS_o_ai 3931 vec_eqv(vector signed long long __a, vector signed long long __b) { 3932 return (vector signed long long)__builtin_vsx_xxleqv( 3933 (vector unsigned int)__a, (vector unsigned int)__b); 3934 } 3935 3936 static __inline__ vector unsigned long long __ATTRS_o_ai 3937 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3938 return (vector unsigned long long)__builtin_vsx_xxleqv( 3939 (vector unsigned int)__a, (vector unsigned int)__b); 3940 } 3941 3942 static __inline__ vector bool long long __ATTRS_o_ai 3943 vec_eqv(vector bool long long __a, vector bool long long __b) { 3944 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3945 (vector unsigned int)__b); 3946 } 3947 3948 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3949 vector float __b) { 3950 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3951 (vector unsigned int)__b); 3952 } 3953 3954 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3955 vector double __b) { 3956 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3957 (vector unsigned int)__b); 3958 } 3959 #endif 3960 3961 /* vec_expte */ 3962 3963 static __inline__ vector float __attribute__((__always_inline__)) 3964 vec_expte(vector float __a) { 3965 return __builtin_altivec_vexptefp(__a); 3966 } 3967 3968 /* vec_vexptefp */ 3969 3970 static __inline__ vector float __attribute__((__always_inline__)) 3971 vec_vexptefp(vector float __a) { 3972 return __builtin_altivec_vexptefp(__a); 3973 } 3974 3975 /* vec_floor */ 3976 3977 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 3978 #ifdef __VSX__ 3979 return __builtin_vsx_xvrspim(__a); 3980 #else 3981 return __builtin_altivec_vrfim(__a); 3982 #endif 3983 } 3984 3985 #ifdef __VSX__ 3986 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 3987 return __builtin_vsx_xvrdpim(__a); 3988 } 3989 #endif 3990 3991 /* vec_roundm */ 3992 static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { 3993 return vec_floor(__a); 3994 } 3995 3996 #ifdef __VSX__ 3997 static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { 3998 return vec_floor(__a); 3999 } 4000 #endif 4001 4002 /* vec_vrfim */ 4003 4004 static __inline__ vector float __attribute__((__always_inline__)) 4005 vec_vrfim(vector float __a) { 4006 return __builtin_altivec_vrfim(__a); 4007 } 4008 4009 /* vec_ld */ 4010 4011 static __inline__ vector signed char __ATTRS_o_ai 4012 vec_ld(long __a, const vector signed char *__b) { 4013 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4014 } 4015 4016 static __inline__ vector signed char __ATTRS_o_ai 4017 vec_ld(long __a, const signed char *__b) { 4018 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4019 } 4020 4021 static __inline__ vector unsigned char __ATTRS_o_ai 4022 vec_ld(long __a, const vector unsigned char *__b) { 4023 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4024 } 4025 4026 static __inline__ vector unsigned char __ATTRS_o_ai 4027 vec_ld(long __a, const unsigned char *__b) { 4028 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4029 } 4030 4031 static __inline__ vector bool char __ATTRS_o_ai 4032 vec_ld(long __a, const vector bool char *__b) { 4033 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4034 } 4035 4036 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, 4037 const vector short *__b) { 4038 return (vector short)__builtin_altivec_lvx(__a, __b); 4039 } 4040 4041 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) { 4042 return (vector short)__builtin_altivec_lvx(__a, __b); 4043 } 4044 4045 static __inline__ vector unsigned short __ATTRS_o_ai 4046 vec_ld(long __a, const vector unsigned short *__b) { 4047 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4048 } 4049 4050 static __inline__ vector unsigned short __ATTRS_o_ai 4051 vec_ld(long __a, const unsigned short *__b) { 4052 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4053 } 4054 4055 static __inline__ vector bool short __ATTRS_o_ai 4056 vec_ld(long __a, const vector bool short *__b) { 4057 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4058 } 4059 4060 static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a, 4061 const vector pixel *__b) { 4062 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4063 } 4064 4065 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, 4066 const vector int *__b) { 4067 return (vector int)__builtin_altivec_lvx(__a, __b); 4068 } 4069 4070 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) { 4071 return (vector int)__builtin_altivec_lvx(__a, __b); 4072 } 4073 4074 static __inline__ vector unsigned int __ATTRS_o_ai 4075 vec_ld(long __a, const vector unsigned int *__b) { 4076 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4077 } 4078 4079 static __inline__ vector unsigned int __ATTRS_o_ai 4080 vec_ld(long __a, const unsigned int *__b) { 4081 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4082 } 4083 4084 static __inline__ vector bool int __ATTRS_o_ai 4085 vec_ld(long __a, const vector bool int *__b) { 4086 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4087 } 4088 4089 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, 4090 const vector float *__b) { 4091 return (vector float)__builtin_altivec_lvx(__a, __b); 4092 } 4093 4094 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) { 4095 return (vector float)__builtin_altivec_lvx(__a, __b); 4096 } 4097 4098 /* vec_lvx */ 4099 4100 static __inline__ vector signed char __ATTRS_o_ai 4101 vec_lvx(long __a, const vector signed char *__b) { 4102 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4103 } 4104 4105 static __inline__ vector signed char __ATTRS_o_ai 4106 vec_lvx(long __a, const signed char *__b) { 4107 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4108 } 4109 4110 static __inline__ vector unsigned char __ATTRS_o_ai 4111 vec_lvx(long __a, const vector unsigned char *__b) { 4112 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4113 } 4114 4115 static __inline__ vector unsigned char __ATTRS_o_ai 4116 vec_lvx(long __a, const unsigned char *__b) { 4117 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4118 } 4119 4120 static __inline__ vector bool char __ATTRS_o_ai 4121 vec_lvx(long __a, const vector bool char *__b) { 4122 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4123 } 4124 4125 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, 4126 const vector short *__b) { 4127 return (vector short)__builtin_altivec_lvx(__a, __b); 4128 } 4129 4130 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) { 4131 return (vector short)__builtin_altivec_lvx(__a, __b); 4132 } 4133 4134 static __inline__ vector unsigned short __ATTRS_o_ai 4135 vec_lvx(long __a, const vector unsigned short *__b) { 4136 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4137 } 4138 4139 static __inline__ vector unsigned short __ATTRS_o_ai 4140 vec_lvx(long __a, const unsigned short *__b) { 4141 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4142 } 4143 4144 static __inline__ vector bool short __ATTRS_o_ai 4145 vec_lvx(long __a, const vector bool short *__b) { 4146 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4147 } 4148 4149 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a, 4150 const vector pixel *__b) { 4151 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4152 } 4153 4154 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, 4155 const vector int *__b) { 4156 return (vector int)__builtin_altivec_lvx(__a, __b); 4157 } 4158 4159 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) { 4160 return (vector int)__builtin_altivec_lvx(__a, __b); 4161 } 4162 4163 static __inline__ vector unsigned int __ATTRS_o_ai 4164 vec_lvx(long __a, const vector unsigned int *__b) { 4165 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4166 } 4167 4168 static __inline__ vector unsigned int __ATTRS_o_ai 4169 vec_lvx(long __a, const unsigned int *__b) { 4170 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4171 } 4172 4173 static __inline__ vector bool int __ATTRS_o_ai 4174 vec_lvx(long __a, const vector bool int *__b) { 4175 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4176 } 4177 4178 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, 4179 const vector float *__b) { 4180 return (vector float)__builtin_altivec_lvx(__a, __b); 4181 } 4182 4183 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) { 4184 return (vector float)__builtin_altivec_lvx(__a, __b); 4185 } 4186 4187 /* vec_lde */ 4188 4189 static __inline__ vector signed char __ATTRS_o_ai 4190 vec_lde(long __a, const signed char *__b) { 4191 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4192 } 4193 4194 static __inline__ vector unsigned char __ATTRS_o_ai 4195 vec_lde(long __a, const unsigned char *__b) { 4196 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4197 } 4198 4199 static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) { 4200 return (vector short)__builtin_altivec_lvehx(__a, __b); 4201 } 4202 4203 static __inline__ vector unsigned short __ATTRS_o_ai 4204 vec_lde(long __a, const unsigned short *__b) { 4205 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4206 } 4207 4208 static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) { 4209 return (vector int)__builtin_altivec_lvewx(__a, __b); 4210 } 4211 4212 static __inline__ vector unsigned int __ATTRS_o_ai 4213 vec_lde(long __a, const unsigned int *__b) { 4214 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4215 } 4216 4217 static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) { 4218 return (vector float)__builtin_altivec_lvewx(__a, __b); 4219 } 4220 4221 /* vec_lvebx */ 4222 4223 static __inline__ vector signed char __ATTRS_o_ai 4224 vec_lvebx(long __a, const signed char *__b) { 4225 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4226 } 4227 4228 static __inline__ vector unsigned char __ATTRS_o_ai 4229 vec_lvebx(long __a, const unsigned char *__b) { 4230 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4231 } 4232 4233 /* vec_lvehx */ 4234 4235 static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, 4236 const short *__b) { 4237 return (vector short)__builtin_altivec_lvehx(__a, __b); 4238 } 4239 4240 static __inline__ vector unsigned short __ATTRS_o_ai 4241 vec_lvehx(long __a, const unsigned short *__b) { 4242 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4243 } 4244 4245 /* vec_lvewx */ 4246 4247 static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) { 4248 return (vector int)__builtin_altivec_lvewx(__a, __b); 4249 } 4250 4251 static __inline__ vector unsigned int __ATTRS_o_ai 4252 vec_lvewx(long __a, const unsigned int *__b) { 4253 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4254 } 4255 4256 static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a, 4257 const float *__b) { 4258 return (vector float)__builtin_altivec_lvewx(__a, __b); 4259 } 4260 4261 /* vec_ldl */ 4262 4263 static __inline__ vector signed char __ATTRS_o_ai 4264 vec_ldl(long __a, const vector signed char *__b) { 4265 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4266 } 4267 4268 static __inline__ vector signed char __ATTRS_o_ai 4269 vec_ldl(long __a, const signed char *__b) { 4270 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4271 } 4272 4273 static __inline__ vector unsigned char __ATTRS_o_ai 4274 vec_ldl(long __a, const vector unsigned char *__b) { 4275 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4276 } 4277 4278 static __inline__ vector unsigned char __ATTRS_o_ai 4279 vec_ldl(long __a, const unsigned char *__b) { 4280 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4281 } 4282 4283 static __inline__ vector bool char __ATTRS_o_ai 4284 vec_ldl(long __a, const vector bool char *__b) { 4285 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4286 } 4287 4288 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, 4289 const vector short *__b) { 4290 return (vector short)__builtin_altivec_lvxl(__a, __b); 4291 } 4292 4293 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) { 4294 return (vector short)__builtin_altivec_lvxl(__a, __b); 4295 } 4296 4297 static __inline__ vector unsigned short __ATTRS_o_ai 4298 vec_ldl(long __a, const vector unsigned short *__b) { 4299 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4300 } 4301 4302 static __inline__ vector unsigned short __ATTRS_o_ai 4303 vec_ldl(long __a, const unsigned short *__b) { 4304 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4305 } 4306 4307 static __inline__ vector bool short __ATTRS_o_ai 4308 vec_ldl(long __a, const vector bool short *__b) { 4309 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4310 } 4311 4312 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a, 4313 const vector pixel *__b) { 4314 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 4315 } 4316 4317 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, 4318 const vector int *__b) { 4319 return (vector int)__builtin_altivec_lvxl(__a, __b); 4320 } 4321 4322 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) { 4323 return (vector int)__builtin_altivec_lvxl(__a, __b); 4324 } 4325 4326 static __inline__ vector unsigned int __ATTRS_o_ai 4327 vec_ldl(long __a, const vector unsigned int *__b) { 4328 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4329 } 4330 4331 static __inline__ vector unsigned int __ATTRS_o_ai 4332 vec_ldl(long __a, const unsigned int *__b) { 4333 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4334 } 4335 4336 static __inline__ vector bool int __ATTRS_o_ai 4337 vec_ldl(long __a, const vector bool int *__b) { 4338 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4339 } 4340 4341 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, 4342 const vector float *__b) { 4343 return (vector float)__builtin_altivec_lvxl(__a, __b); 4344 } 4345 4346 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) { 4347 return (vector float)__builtin_altivec_lvxl(__a, __b); 4348 } 4349 4350 /* vec_lvxl */ 4351 4352 static __inline__ vector signed char __ATTRS_o_ai 4353 vec_lvxl(long __a, const vector signed char *__b) { 4354 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4355 } 4356 4357 static __inline__ vector signed char __ATTRS_o_ai 4358 vec_lvxl(long __a, const signed char *__b) { 4359 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4360 } 4361 4362 static __inline__ vector unsigned char __ATTRS_o_ai 4363 vec_lvxl(long __a, const vector unsigned char *__b) { 4364 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4365 } 4366 4367 static __inline__ vector unsigned char __ATTRS_o_ai 4368 vec_lvxl(long __a, const unsigned char *__b) { 4369 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4370 } 4371 4372 static __inline__ vector bool char __ATTRS_o_ai 4373 vec_lvxl(long __a, const vector bool char *__b) { 4374 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4375 } 4376 4377 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4378 const vector short *__b) { 4379 return (vector short)__builtin_altivec_lvxl(__a, __b); 4380 } 4381 4382 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4383 const short *__b) { 4384 return (vector short)__builtin_altivec_lvxl(__a, __b); 4385 } 4386 4387 static __inline__ vector unsigned short __ATTRS_o_ai 4388 vec_lvxl(long __a, const vector unsigned short *__b) { 4389 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4390 } 4391 4392 static __inline__ vector unsigned short __ATTRS_o_ai 4393 vec_lvxl(long __a, const unsigned short *__b) { 4394 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4395 } 4396 4397 static __inline__ vector bool short __ATTRS_o_ai 4398 vec_lvxl(long __a, const vector bool short *__b) { 4399 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4400 } 4401 4402 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a, 4403 const vector pixel *__b) { 4404 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 4405 } 4406 4407 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, 4408 const vector int *__b) { 4409 return (vector int)__builtin_altivec_lvxl(__a, __b); 4410 } 4411 4412 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) { 4413 return (vector int)__builtin_altivec_lvxl(__a, __b); 4414 } 4415 4416 static __inline__ vector unsigned int __ATTRS_o_ai 4417 vec_lvxl(long __a, const vector unsigned int *__b) { 4418 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4419 } 4420 4421 static __inline__ vector unsigned int __ATTRS_o_ai 4422 vec_lvxl(long __a, const unsigned int *__b) { 4423 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4424 } 4425 4426 static __inline__ vector bool int __ATTRS_o_ai 4427 vec_lvxl(long __a, const vector bool int *__b) { 4428 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4429 } 4430 4431 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4432 const vector float *__b) { 4433 return (vector float)__builtin_altivec_lvxl(__a, __b); 4434 } 4435 4436 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4437 const float *__b) { 4438 return (vector float)__builtin_altivec_lvxl(__a, __b); 4439 } 4440 4441 /* vec_loge */ 4442 4443 static __inline__ vector float __attribute__((__always_inline__)) 4444 vec_loge(vector float __a) { 4445 return __builtin_altivec_vlogefp(__a); 4446 } 4447 4448 /* vec_vlogefp */ 4449 4450 static __inline__ vector float __attribute__((__always_inline__)) 4451 vec_vlogefp(vector float __a) { 4452 return __builtin_altivec_vlogefp(__a); 4453 } 4454 4455 /* vec_lvsl */ 4456 4457 #ifdef __LITTLE_ENDIAN__ 4458 static __inline__ vector unsigned char __ATTRS_o_ai 4459 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4460 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 4461 vector unsigned char mask = 4462 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4463 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4464 7, 6, 5, 4, 3, 2, 1, 0}; 4465 return vec_perm(mask, mask, reverse); 4466 } 4467 #else 4468 static __inline__ vector unsigned char __ATTRS_o_ai 4469 vec_lvsl(int __a, const signed char *__b) { 4470 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4471 } 4472 #endif 4473 4474 #ifdef __LITTLE_ENDIAN__ 4475 static __inline__ vector unsigned char __ATTRS_o_ai 4476 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4477 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 4478 vector unsigned char mask = 4479 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4480 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4481 7, 6, 5, 4, 3, 2, 1, 0}; 4482 return vec_perm(mask, mask, reverse); 4483 } 4484 #else 4485 static __inline__ vector unsigned char __ATTRS_o_ai 4486 vec_lvsl(int __a, const unsigned char *__b) { 4487 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4488 } 4489 #endif 4490 4491 #ifdef __LITTLE_ENDIAN__ 4492 static __inline__ vector unsigned char __ATTRS_o_ai 4493 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4494 loads/stores"))) vec_lvsl(int __a, const short *__b) { 4495 vector unsigned char mask = 4496 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4497 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4498 7, 6, 5, 4, 3, 2, 1, 0}; 4499 return vec_perm(mask, mask, reverse); 4500 } 4501 #else 4502 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4503 const short *__b) { 4504 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4505 } 4506 #endif 4507 4508 #ifdef __LITTLE_ENDIAN__ 4509 static __inline__ vector unsigned char __ATTRS_o_ai 4510 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4511 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4512 vector unsigned char mask = 4513 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4514 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4515 7, 6, 5, 4, 3, 2, 1, 0}; 4516 return vec_perm(mask, mask, reverse); 4517 } 4518 #else 4519 static __inline__ vector unsigned char __ATTRS_o_ai 4520 vec_lvsl(int __a, const unsigned short *__b) { 4521 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4522 } 4523 #endif 4524 4525 #ifdef __LITTLE_ENDIAN__ 4526 static __inline__ vector unsigned char __ATTRS_o_ai 4527 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4528 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4529 vector unsigned char mask = 4530 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4531 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4532 7, 6, 5, 4, 3, 2, 1, 0}; 4533 return vec_perm(mask, mask, reverse); 4534 } 4535 #else 4536 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4537 const int *__b) { 4538 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4539 } 4540 #endif 4541 4542 #ifdef __LITTLE_ENDIAN__ 4543 static __inline__ vector unsigned char __ATTRS_o_ai 4544 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4545 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4546 vector unsigned char mask = 4547 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4548 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4549 7, 6, 5, 4, 3, 2, 1, 0}; 4550 return vec_perm(mask, mask, reverse); 4551 } 4552 #else 4553 static __inline__ vector unsigned char __ATTRS_o_ai 4554 vec_lvsl(int __a, const unsigned int *__b) { 4555 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4556 } 4557 #endif 4558 4559 #ifdef __LITTLE_ENDIAN__ 4560 static __inline__ vector unsigned char __ATTRS_o_ai 4561 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4562 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4563 vector unsigned char mask = 4564 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4565 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4566 7, 6, 5, 4, 3, 2, 1, 0}; 4567 return vec_perm(mask, mask, reverse); 4568 } 4569 #else 4570 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4571 const float *__b) { 4572 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4573 } 4574 #endif 4575 4576 /* vec_lvsr */ 4577 4578 #ifdef __LITTLE_ENDIAN__ 4579 static __inline__ vector unsigned char __ATTRS_o_ai 4580 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4581 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4582 vector unsigned char mask = 4583 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4584 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4585 7, 6, 5, 4, 3, 2, 1, 0}; 4586 return vec_perm(mask, mask, reverse); 4587 } 4588 #else 4589 static __inline__ vector unsigned char __ATTRS_o_ai 4590 vec_lvsr(int __a, const signed char *__b) { 4591 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4592 } 4593 #endif 4594 4595 #ifdef __LITTLE_ENDIAN__ 4596 static __inline__ vector unsigned char __ATTRS_o_ai 4597 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4598 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4599 vector unsigned char mask = 4600 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4601 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4602 7, 6, 5, 4, 3, 2, 1, 0}; 4603 return vec_perm(mask, mask, reverse); 4604 } 4605 #else 4606 static __inline__ vector unsigned char __ATTRS_o_ai 4607 vec_lvsr(int __a, const unsigned char *__b) { 4608 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4609 } 4610 #endif 4611 4612 #ifdef __LITTLE_ENDIAN__ 4613 static __inline__ vector unsigned char __ATTRS_o_ai 4614 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4615 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4616 vector unsigned char mask = 4617 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4618 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4619 7, 6, 5, 4, 3, 2, 1, 0}; 4620 return vec_perm(mask, mask, reverse); 4621 } 4622 #else 4623 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4624 const short *__b) { 4625 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4626 } 4627 #endif 4628 4629 #ifdef __LITTLE_ENDIAN__ 4630 static __inline__ vector unsigned char __ATTRS_o_ai 4631 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4632 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4633 vector unsigned char mask = 4634 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4635 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4636 7, 6, 5, 4, 3, 2, 1, 0}; 4637 return vec_perm(mask, mask, reverse); 4638 } 4639 #else 4640 static __inline__ vector unsigned char __ATTRS_o_ai 4641 vec_lvsr(int __a, const unsigned short *__b) { 4642 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4643 } 4644 #endif 4645 4646 #ifdef __LITTLE_ENDIAN__ 4647 static __inline__ vector unsigned char __ATTRS_o_ai 4648 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4649 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4650 vector unsigned char mask = 4651 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4652 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4653 7, 6, 5, 4, 3, 2, 1, 0}; 4654 return vec_perm(mask, mask, reverse); 4655 } 4656 #else 4657 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4658 const int *__b) { 4659 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4660 } 4661 #endif 4662 4663 #ifdef __LITTLE_ENDIAN__ 4664 static __inline__ vector unsigned char __ATTRS_o_ai 4665 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4666 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4667 vector unsigned char mask = 4668 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4669 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4670 7, 6, 5, 4, 3, 2, 1, 0}; 4671 return vec_perm(mask, mask, reverse); 4672 } 4673 #else 4674 static __inline__ vector unsigned char __ATTRS_o_ai 4675 vec_lvsr(int __a, const unsigned int *__b) { 4676 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4677 } 4678 #endif 4679 4680 #ifdef __LITTLE_ENDIAN__ 4681 static __inline__ vector unsigned char __ATTRS_o_ai 4682 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4683 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4684 vector unsigned char mask = 4685 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4686 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4687 7, 6, 5, 4, 3, 2, 1, 0}; 4688 return vec_perm(mask, mask, reverse); 4689 } 4690 #else 4691 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4692 const float *__b) { 4693 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4694 } 4695 #endif 4696 4697 /* vec_madd */ 4698 static __inline__ vector signed short __ATTRS_o_ai 4699 vec_mladd(vector signed short, vector signed short, vector signed short); 4700 static __inline__ vector signed short __ATTRS_o_ai 4701 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4702 static __inline__ vector signed short __ATTRS_o_ai 4703 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4704 static __inline__ vector unsigned short __ATTRS_o_ai 4705 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4706 4707 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4708 vector signed short __a, vector signed short __b, vector signed short __c) { 4709 return vec_mladd(__a, __b, __c); 4710 } 4711 4712 static __inline__ vector signed short __ATTRS_o_ai 4713 vec_madd(vector signed short __a, vector unsigned short __b, 4714 vector unsigned short __c) { 4715 return vec_mladd(__a, __b, __c); 4716 } 4717 4718 static __inline__ vector signed short __ATTRS_o_ai 4719 vec_madd(vector unsigned short __a, vector signed short __b, 4720 vector signed short __c) { 4721 return vec_mladd(__a, __b, __c); 4722 } 4723 4724 static __inline__ vector unsigned short __ATTRS_o_ai 4725 vec_madd(vector unsigned short __a, vector unsigned short __b, 4726 vector unsigned short __c) { 4727 return vec_mladd(__a, __b, __c); 4728 } 4729 4730 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4731 vector float __b, 4732 vector float __c) { 4733 #ifdef __VSX__ 4734 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4735 #else 4736 return __builtin_altivec_vmaddfp(__a, __b, __c); 4737 #endif 4738 } 4739 4740 #ifdef __VSX__ 4741 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4742 vector double __b, 4743 vector double __c) { 4744 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4745 } 4746 #endif 4747 4748 /* vec_vmaddfp */ 4749 4750 static __inline__ vector float __attribute__((__always_inline__)) 4751 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4752 return __builtin_altivec_vmaddfp(__a, __b, __c); 4753 } 4754 4755 /* vec_madds */ 4756 4757 static __inline__ vector signed short __attribute__((__always_inline__)) 4758 vec_madds(vector signed short __a, vector signed short __b, 4759 vector signed short __c) { 4760 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4761 } 4762 4763 /* vec_vmhaddshs */ 4764 static __inline__ vector signed short __attribute__((__always_inline__)) 4765 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4766 vector signed short __c) { 4767 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4768 } 4769 4770 /* vec_msub */ 4771 4772 #ifdef __VSX__ 4773 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4774 vector float __b, 4775 vector float __c) { 4776 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4777 } 4778 4779 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4780 vector double __b, 4781 vector double __c) { 4782 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4783 } 4784 #endif 4785 4786 /* vec_max */ 4787 4788 static __inline__ vector signed char __ATTRS_o_ai 4789 vec_max(vector signed char __a, vector signed char __b) { 4790 return __builtin_altivec_vmaxsb(__a, __b); 4791 } 4792 4793 static __inline__ vector signed char __ATTRS_o_ai 4794 vec_max(vector bool char __a, vector signed char __b) { 4795 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4796 } 4797 4798 static __inline__ vector signed char __ATTRS_o_ai 4799 vec_max(vector signed char __a, vector bool char __b) { 4800 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4801 } 4802 4803 static __inline__ vector unsigned char __ATTRS_o_ai 4804 vec_max(vector unsigned char __a, vector unsigned char __b) { 4805 return __builtin_altivec_vmaxub(__a, __b); 4806 } 4807 4808 static __inline__ vector unsigned char __ATTRS_o_ai 4809 vec_max(vector bool char __a, vector unsigned char __b) { 4810 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4811 } 4812 4813 static __inline__ vector unsigned char __ATTRS_o_ai 4814 vec_max(vector unsigned char __a, vector bool char __b) { 4815 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4816 } 4817 4818 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4819 vector short __b) { 4820 return __builtin_altivec_vmaxsh(__a, __b); 4821 } 4822 4823 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4824 vector short __b) { 4825 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4826 } 4827 4828 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4829 vector bool short __b) { 4830 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4831 } 4832 4833 static __inline__ vector unsigned short __ATTRS_o_ai 4834 vec_max(vector unsigned short __a, vector unsigned short __b) { 4835 return __builtin_altivec_vmaxuh(__a, __b); 4836 } 4837 4838 static __inline__ vector unsigned short __ATTRS_o_ai 4839 vec_max(vector bool short __a, vector unsigned short __b) { 4840 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4841 } 4842 4843 static __inline__ vector unsigned short __ATTRS_o_ai 4844 vec_max(vector unsigned short __a, vector bool short __b) { 4845 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4846 } 4847 4848 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4849 vector int __b) { 4850 return __builtin_altivec_vmaxsw(__a, __b); 4851 } 4852 4853 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4854 vector int __b) { 4855 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4856 } 4857 4858 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4859 vector bool int __b) { 4860 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4861 } 4862 4863 static __inline__ vector unsigned int __ATTRS_o_ai 4864 vec_max(vector unsigned int __a, vector unsigned int __b) { 4865 return __builtin_altivec_vmaxuw(__a, __b); 4866 } 4867 4868 static __inline__ vector unsigned int __ATTRS_o_ai 4869 vec_max(vector bool int __a, vector unsigned int __b) { 4870 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4871 } 4872 4873 static __inline__ vector unsigned int __ATTRS_o_ai 4874 vec_max(vector unsigned int __a, vector bool int __b) { 4875 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4876 } 4877 4878 #ifdef __POWER8_VECTOR__ 4879 static __inline__ vector signed long long __ATTRS_o_ai 4880 vec_max(vector signed long long __a, vector signed long long __b) { 4881 return __builtin_altivec_vmaxsd(__a, __b); 4882 } 4883 4884 static __inline__ vector signed long long __ATTRS_o_ai 4885 vec_max(vector bool long long __a, vector signed long long __b) { 4886 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4887 } 4888 4889 static __inline__ vector signed long long __ATTRS_o_ai 4890 vec_max(vector signed long long __a, vector bool long long __b) { 4891 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4892 } 4893 4894 static __inline__ vector unsigned long long __ATTRS_o_ai 4895 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4896 return __builtin_altivec_vmaxud(__a, __b); 4897 } 4898 4899 static __inline__ vector unsigned long long __ATTRS_o_ai 4900 vec_max(vector bool long long __a, vector unsigned long long __b) { 4901 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4902 } 4903 4904 static __inline__ vector unsigned long long __ATTRS_o_ai 4905 vec_max(vector unsigned long long __a, vector bool long long __b) { 4906 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4907 } 4908 #endif 4909 4910 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4911 vector float __b) { 4912 #ifdef __VSX__ 4913 return __builtin_vsx_xvmaxsp(__a, __b); 4914 #else 4915 return __builtin_altivec_vmaxfp(__a, __b); 4916 #endif 4917 } 4918 4919 #ifdef __VSX__ 4920 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4921 vector double __b) { 4922 return __builtin_vsx_xvmaxdp(__a, __b); 4923 } 4924 #endif 4925 4926 /* vec_vmaxsb */ 4927 4928 static __inline__ vector signed char __ATTRS_o_ai 4929 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4930 return __builtin_altivec_vmaxsb(__a, __b); 4931 } 4932 4933 static __inline__ vector signed char __ATTRS_o_ai 4934 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4935 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4936 } 4937 4938 static __inline__ vector signed char __ATTRS_o_ai 4939 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4940 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4941 } 4942 4943 /* vec_vmaxub */ 4944 4945 static __inline__ vector unsigned char __ATTRS_o_ai 4946 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4947 return __builtin_altivec_vmaxub(__a, __b); 4948 } 4949 4950 static __inline__ vector unsigned char __ATTRS_o_ai 4951 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4952 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4953 } 4954 4955 static __inline__ vector unsigned char __ATTRS_o_ai 4956 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4957 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4958 } 4959 4960 /* vec_vmaxsh */ 4961 4962 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4963 vector short __b) { 4964 return __builtin_altivec_vmaxsh(__a, __b); 4965 } 4966 4967 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 4968 vector short __b) { 4969 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4970 } 4971 4972 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4973 vector bool short __b) { 4974 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4975 } 4976 4977 /* vec_vmaxuh */ 4978 4979 static __inline__ vector unsigned short __ATTRS_o_ai 4980 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 4981 return __builtin_altivec_vmaxuh(__a, __b); 4982 } 4983 4984 static __inline__ vector unsigned short __ATTRS_o_ai 4985 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 4986 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4987 } 4988 4989 static __inline__ vector unsigned short __ATTRS_o_ai 4990 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 4991 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4992 } 4993 4994 /* vec_vmaxsw */ 4995 4996 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4997 vector int __b) { 4998 return __builtin_altivec_vmaxsw(__a, __b); 4999 } 5000 5001 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 5002 vector int __b) { 5003 return __builtin_altivec_vmaxsw((vector int)__a, __b); 5004 } 5005 5006 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 5007 vector bool int __b) { 5008 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 5009 } 5010 5011 /* vec_vmaxuw */ 5012 5013 static __inline__ vector unsigned int __ATTRS_o_ai 5014 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 5015 return __builtin_altivec_vmaxuw(__a, __b); 5016 } 5017 5018 static __inline__ vector unsigned int __ATTRS_o_ai 5019 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 5020 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 5021 } 5022 5023 static __inline__ vector unsigned int __ATTRS_o_ai 5024 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 5025 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 5026 } 5027 5028 /* vec_vmaxfp */ 5029 5030 static __inline__ vector float __attribute__((__always_inline__)) 5031 vec_vmaxfp(vector float __a, vector float __b) { 5032 #ifdef __VSX__ 5033 return __builtin_vsx_xvmaxsp(__a, __b); 5034 #else 5035 return __builtin_altivec_vmaxfp(__a, __b); 5036 #endif 5037 } 5038 5039 /* vec_mergeh */ 5040 5041 static __inline__ vector signed char __ATTRS_o_ai 5042 vec_mergeh(vector signed char __a, vector signed char __b) { 5043 return vec_perm(__a, __b, 5044 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5045 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5046 0x06, 0x16, 0x07, 0x17)); 5047 } 5048 5049 static __inline__ vector unsigned char __ATTRS_o_ai 5050 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 5051 return vec_perm(__a, __b, 5052 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5053 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5054 0x06, 0x16, 0x07, 0x17)); 5055 } 5056 5057 static __inline__ vector bool char __ATTRS_o_ai 5058 vec_mergeh(vector bool char __a, vector bool char __b) { 5059 return vec_perm(__a, __b, 5060 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5061 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5062 0x06, 0x16, 0x07, 0x17)); 5063 } 5064 5065 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 5066 vector short __b) { 5067 return vec_perm(__a, __b, 5068 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5069 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5070 0x06, 0x07, 0x16, 0x17)); 5071 } 5072 5073 static __inline__ vector unsigned short __ATTRS_o_ai 5074 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 5075 return vec_perm(__a, __b, 5076 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5077 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5078 0x06, 0x07, 0x16, 0x17)); 5079 } 5080 5081 static __inline__ vector bool short __ATTRS_o_ai 5082 vec_mergeh(vector bool short __a, vector bool short __b) { 5083 return vec_perm(__a, __b, 5084 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5085 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5086 0x06, 0x07, 0x16, 0x17)); 5087 } 5088 5089 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 5090 vector pixel __b) { 5091 return vec_perm(__a, __b, 5092 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5093 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5094 0x06, 0x07, 0x16, 0x17)); 5095 } 5096 5097 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 5098 vector int __b) { 5099 return vec_perm(__a, __b, 5100 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5101 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5102 0x14, 0x15, 0x16, 0x17)); 5103 } 5104 5105 static __inline__ vector unsigned int __ATTRS_o_ai 5106 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 5107 return vec_perm(__a, __b, 5108 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5109 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5110 0x14, 0x15, 0x16, 0x17)); 5111 } 5112 5113 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 5114 vector bool int __b) { 5115 return vec_perm(__a, __b, 5116 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5117 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5118 0x14, 0x15, 0x16, 0x17)); 5119 } 5120 5121 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 5122 vector float __b) { 5123 return vec_perm(__a, __b, 5124 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5125 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5126 0x14, 0x15, 0x16, 0x17)); 5127 } 5128 5129 #ifdef __VSX__ 5130 static __inline__ vector signed long long __ATTRS_o_ai 5131 vec_mergeh(vector signed long long __a, vector signed long long __b) { 5132 return vec_perm(__a, __b, 5133 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5134 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5135 0x14, 0x15, 0x16, 0x17)); 5136 } 5137 5138 static __inline__ vector signed long long __ATTRS_o_ai 5139 vec_mergeh(vector signed long long __a, vector bool long long __b) { 5140 return vec_perm(__a, (vector signed long long)__b, 5141 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5142 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5143 0x14, 0x15, 0x16, 0x17)); 5144 } 5145 5146 static __inline__ vector signed long long __ATTRS_o_ai 5147 vec_mergeh(vector bool long long __a, vector signed long long __b) { 5148 return vec_perm((vector signed long long)__a, __b, 5149 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5150 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5151 0x14, 0x15, 0x16, 0x17)); 5152 } 5153 5154 static __inline__ vector unsigned long long __ATTRS_o_ai 5155 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 5156 return vec_perm(__a, __b, 5157 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5158 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5159 0x14, 0x15, 0x16, 0x17)); 5160 } 5161 5162 static __inline__ vector unsigned long long __ATTRS_o_ai 5163 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 5164 return vec_perm(__a, (vector unsigned long long)__b, 5165 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5166 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5167 0x14, 0x15, 0x16, 0x17)); 5168 } 5169 5170 static __inline__ vector unsigned long long __ATTRS_o_ai 5171 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 5172 return vec_perm((vector unsigned long long)__a, __b, 5173 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5174 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5175 0x14, 0x15, 0x16, 0x17)); 5176 } 5177 5178 static __inline__ vector bool long long __ATTRS_o_ai 5179 vec_mergeh(vector bool long long __a, vector bool long long __b) { 5180 return vec_perm(__a, __b, 5181 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5182 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5183 0x14, 0x15, 0x16, 0x17)); 5184 } 5185 5186 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 5187 vector double __b) { 5188 return vec_perm(__a, __b, 5189 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5190 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5191 0x14, 0x15, 0x16, 0x17)); 5192 } 5193 static __inline__ vector double __ATTRS_o_ai 5194 vec_mergeh(vector double __a, vector bool long long __b) { 5195 return vec_perm(__a, (vector double)__b, 5196 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5197 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5198 0x14, 0x15, 0x16, 0x17)); 5199 } 5200 static __inline__ vector double __ATTRS_o_ai 5201 vec_mergeh(vector bool long long __a, vector double __b) { 5202 return vec_perm((vector double)__a, __b, 5203 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5204 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5205 0x14, 0x15, 0x16, 0x17)); 5206 } 5207 #endif 5208 5209 /* vec_vmrghb */ 5210 5211 #define __builtin_altivec_vmrghb vec_vmrghb 5212 5213 static __inline__ vector signed char __ATTRS_o_ai 5214 vec_vmrghb(vector signed char __a, vector signed char __b) { 5215 return vec_perm(__a, __b, 5216 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5217 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5218 0x06, 0x16, 0x07, 0x17)); 5219 } 5220 5221 static __inline__ vector unsigned char __ATTRS_o_ai 5222 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 5223 return vec_perm(__a, __b, 5224 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5225 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5226 0x06, 0x16, 0x07, 0x17)); 5227 } 5228 5229 static __inline__ vector bool char __ATTRS_o_ai 5230 vec_vmrghb(vector bool char __a, vector bool char __b) { 5231 return vec_perm(__a, __b, 5232 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5233 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5234 0x06, 0x16, 0x07, 0x17)); 5235 } 5236 5237 /* vec_vmrghh */ 5238 5239 #define __builtin_altivec_vmrghh vec_vmrghh 5240 5241 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 5242 vector short __b) { 5243 return vec_perm(__a, __b, 5244 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5245 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5246 0x06, 0x07, 0x16, 0x17)); 5247 } 5248 5249 static __inline__ vector unsigned short __ATTRS_o_ai 5250 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 5251 return vec_perm(__a, __b, 5252 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5253 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5254 0x06, 0x07, 0x16, 0x17)); 5255 } 5256 5257 static __inline__ vector bool short __ATTRS_o_ai 5258 vec_vmrghh(vector bool short __a, vector bool short __b) { 5259 return vec_perm(__a, __b, 5260 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5261 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5262 0x06, 0x07, 0x16, 0x17)); 5263 } 5264 5265 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 5266 vector pixel __b) { 5267 return vec_perm(__a, __b, 5268 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5269 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5270 0x06, 0x07, 0x16, 0x17)); 5271 } 5272 5273 /* vec_vmrghw */ 5274 5275 #define __builtin_altivec_vmrghw vec_vmrghw 5276 5277 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 5278 vector int __b) { 5279 return vec_perm(__a, __b, 5280 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5281 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5282 0x14, 0x15, 0x16, 0x17)); 5283 } 5284 5285 static __inline__ vector unsigned int __ATTRS_o_ai 5286 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 5287 return vec_perm(__a, __b, 5288 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5289 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5290 0x14, 0x15, 0x16, 0x17)); 5291 } 5292 5293 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 5294 vector bool int __b) { 5295 return vec_perm(__a, __b, 5296 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5297 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5298 0x14, 0x15, 0x16, 0x17)); 5299 } 5300 5301 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 5302 vector float __b) { 5303 return vec_perm(__a, __b, 5304 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5305 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5306 0x14, 0x15, 0x16, 0x17)); 5307 } 5308 5309 /* vec_mergel */ 5310 5311 static __inline__ vector signed char __ATTRS_o_ai 5312 vec_mergel(vector signed char __a, vector signed char __b) { 5313 return vec_perm(__a, __b, 5314 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5315 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5316 0x0E, 0x1E, 0x0F, 0x1F)); 5317 } 5318 5319 static __inline__ vector unsigned char __ATTRS_o_ai 5320 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 5321 return vec_perm(__a, __b, 5322 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5323 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5324 0x0E, 0x1E, 0x0F, 0x1F)); 5325 } 5326 5327 static __inline__ vector bool char __ATTRS_o_ai 5328 vec_mergel(vector bool char __a, vector bool char __b) { 5329 return vec_perm(__a, __b, 5330 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5331 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5332 0x0E, 0x1E, 0x0F, 0x1F)); 5333 } 5334 5335 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 5336 vector short __b) { 5337 return vec_perm(__a, __b, 5338 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5339 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5340 0x0E, 0x0F, 0x1E, 0x1F)); 5341 } 5342 5343 static __inline__ vector unsigned short __ATTRS_o_ai 5344 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 5345 return vec_perm(__a, __b, 5346 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5347 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5348 0x0E, 0x0F, 0x1E, 0x1F)); 5349 } 5350 5351 static __inline__ vector bool short __ATTRS_o_ai 5352 vec_mergel(vector bool short __a, vector bool short __b) { 5353 return vec_perm(__a, __b, 5354 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5355 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5356 0x0E, 0x0F, 0x1E, 0x1F)); 5357 } 5358 5359 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 5360 vector pixel __b) { 5361 return vec_perm(__a, __b, 5362 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5363 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5364 0x0E, 0x0F, 0x1E, 0x1F)); 5365 } 5366 5367 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 5368 vector int __b) { 5369 return vec_perm(__a, __b, 5370 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5371 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5372 0x1C, 0x1D, 0x1E, 0x1F)); 5373 } 5374 5375 static __inline__ vector unsigned int __ATTRS_o_ai 5376 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 5377 return vec_perm(__a, __b, 5378 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5379 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5380 0x1C, 0x1D, 0x1E, 0x1F)); 5381 } 5382 5383 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 5384 vector bool int __b) { 5385 return vec_perm(__a, __b, 5386 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5387 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5388 0x1C, 0x1D, 0x1E, 0x1F)); 5389 } 5390 5391 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 5392 vector float __b) { 5393 return vec_perm(__a, __b, 5394 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5395 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5396 0x1C, 0x1D, 0x1E, 0x1F)); 5397 } 5398 5399 #ifdef __VSX__ 5400 static __inline__ vector signed long long __ATTRS_o_ai 5401 vec_mergel(vector signed long long __a, vector signed long long __b) { 5402 return vec_perm(__a, __b, 5403 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5404 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5405 0x1C, 0x1D, 0x1E, 0x1F)); 5406 } 5407 static __inline__ vector signed long long __ATTRS_o_ai 5408 vec_mergel(vector signed long long __a, vector bool long long __b) { 5409 return vec_perm(__a, (vector signed long long)__b, 5410 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5411 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5412 0x1C, 0x1D, 0x1E, 0x1F)); 5413 } 5414 static __inline__ vector signed long long __ATTRS_o_ai 5415 vec_mergel(vector bool long long __a, vector signed long long __b) { 5416 return vec_perm((vector signed long long)__a, __b, 5417 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5418 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5419 0x1C, 0x1D, 0x1E, 0x1F)); 5420 } 5421 static __inline__ vector unsigned long long __ATTRS_o_ai 5422 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 5423 return vec_perm(__a, __b, 5424 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5425 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5426 0x1C, 0x1D, 0x1E, 0x1F)); 5427 } 5428 static __inline__ vector unsigned long long __ATTRS_o_ai 5429 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 5430 return vec_perm(__a, (vector unsigned long long)__b, 5431 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5432 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5433 0x1C, 0x1D, 0x1E, 0x1F)); 5434 } 5435 static __inline__ vector unsigned long long __ATTRS_o_ai 5436 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 5437 return vec_perm((vector unsigned long long)__a, __b, 5438 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5439 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5440 0x1C, 0x1D, 0x1E, 0x1F)); 5441 } 5442 static __inline__ vector bool long long __ATTRS_o_ai 5443 vec_mergel(vector bool long long __a, vector bool long long __b) { 5444 return vec_perm(__a, __b, 5445 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5446 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5447 0x1C, 0x1D, 0x1E, 0x1F)); 5448 } 5449 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 5450 vector double __b) { 5451 return vec_perm(__a, __b, 5452 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5453 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5454 0x1C, 0x1D, 0x1E, 0x1F)); 5455 } 5456 static __inline__ vector double __ATTRS_o_ai 5457 vec_mergel(vector double __a, vector bool long long __b) { 5458 return vec_perm(__a, (vector double)__b, 5459 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5460 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5461 0x1C, 0x1D, 0x1E, 0x1F)); 5462 } 5463 static __inline__ vector double __ATTRS_o_ai 5464 vec_mergel(vector bool long long __a, vector double __b) { 5465 return vec_perm((vector double)__a, __b, 5466 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5467 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5468 0x1C, 0x1D, 0x1E, 0x1F)); 5469 } 5470 #endif 5471 5472 /* vec_vmrglb */ 5473 5474 #define __builtin_altivec_vmrglb vec_vmrglb 5475 5476 static __inline__ vector signed char __ATTRS_o_ai 5477 vec_vmrglb(vector signed char __a, vector signed char __b) { 5478 return vec_perm(__a, __b, 5479 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5480 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5481 0x0E, 0x1E, 0x0F, 0x1F)); 5482 } 5483 5484 static __inline__ vector unsigned char __ATTRS_o_ai 5485 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 5486 return vec_perm(__a, __b, 5487 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5488 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5489 0x0E, 0x1E, 0x0F, 0x1F)); 5490 } 5491 5492 static __inline__ vector bool char __ATTRS_o_ai 5493 vec_vmrglb(vector bool char __a, vector bool char __b) { 5494 return vec_perm(__a, __b, 5495 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5496 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5497 0x0E, 0x1E, 0x0F, 0x1F)); 5498 } 5499 5500 /* vec_vmrglh */ 5501 5502 #define __builtin_altivec_vmrglh vec_vmrglh 5503 5504 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 5505 vector short __b) { 5506 return vec_perm(__a, __b, 5507 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5508 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5509 0x0E, 0x0F, 0x1E, 0x1F)); 5510 } 5511 5512 static __inline__ vector unsigned short __ATTRS_o_ai 5513 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5514 return vec_perm(__a, __b, 5515 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5516 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5517 0x0E, 0x0F, 0x1E, 0x1F)); 5518 } 5519 5520 static __inline__ vector bool short __ATTRS_o_ai 5521 vec_vmrglh(vector bool short __a, vector bool short __b) { 5522 return vec_perm(__a, __b, 5523 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5524 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5525 0x0E, 0x0F, 0x1E, 0x1F)); 5526 } 5527 5528 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5529 vector pixel __b) { 5530 return vec_perm(__a, __b, 5531 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5532 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5533 0x0E, 0x0F, 0x1E, 0x1F)); 5534 } 5535 5536 /* vec_vmrglw */ 5537 5538 #define __builtin_altivec_vmrglw vec_vmrglw 5539 5540 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5541 vector int __b) { 5542 return vec_perm(__a, __b, 5543 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5544 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5545 0x1C, 0x1D, 0x1E, 0x1F)); 5546 } 5547 5548 static __inline__ vector unsigned int __ATTRS_o_ai 5549 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5550 return vec_perm(__a, __b, 5551 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5552 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5553 0x1C, 0x1D, 0x1E, 0x1F)); 5554 } 5555 5556 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5557 vector bool int __b) { 5558 return vec_perm(__a, __b, 5559 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5560 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5561 0x1C, 0x1D, 0x1E, 0x1F)); 5562 } 5563 5564 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5565 vector float __b) { 5566 return vec_perm(__a, __b, 5567 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5568 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5569 0x1C, 0x1D, 0x1E, 0x1F)); 5570 } 5571 5572 #ifdef __POWER8_VECTOR__ 5573 /* vec_mergee */ 5574 5575 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5576 vector bool int __b) { 5577 return vec_perm(__a, __b, 5578 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5579 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5580 0x18, 0x19, 0x1A, 0x1B)); 5581 } 5582 5583 static __inline__ vector signed int __ATTRS_o_ai 5584 vec_mergee(vector signed int __a, vector signed int __b) { 5585 return vec_perm(__a, __b, 5586 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5587 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5588 0x18, 0x19, 0x1A, 0x1B)); 5589 } 5590 5591 static __inline__ vector unsigned int __ATTRS_o_ai 5592 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5593 return vec_perm(__a, __b, 5594 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5595 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5596 0x18, 0x19, 0x1A, 0x1B)); 5597 } 5598 5599 static __inline__ vector bool long long __ATTRS_o_ai 5600 vec_mergee(vector bool long long __a, vector bool long long __b) { 5601 return vec_mergeh(__a, __b); 5602 } 5603 5604 static __inline__ vector signed long long __ATTRS_o_ai 5605 vec_mergee(vector signed long long __a, vector signed long long __b) { 5606 return vec_mergeh(__a, __b); 5607 } 5608 5609 static __inline__ vector unsigned long long __ATTRS_o_ai 5610 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5611 return vec_mergeh(__a, __b); 5612 } 5613 5614 static __inline__ vector float __ATTRS_o_ai 5615 vec_mergee(vector float __a, vector float __b) { 5616 return vec_perm(__a, __b, 5617 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5618 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5619 0x18, 0x19, 0x1A, 0x1B)); 5620 } 5621 5622 static __inline__ vector double __ATTRS_o_ai 5623 vec_mergee(vector double __a, vector double __b) { 5624 return vec_mergeh(__a, __b); 5625 } 5626 5627 /* vec_mergeo */ 5628 5629 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5630 vector bool int __b) { 5631 return vec_perm(__a, __b, 5632 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5633 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5634 0x1C, 0x1D, 0x1E, 0x1F)); 5635 } 5636 5637 static __inline__ vector signed int __ATTRS_o_ai 5638 vec_mergeo(vector signed int __a, vector signed int __b) { 5639 return vec_perm(__a, __b, 5640 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5641 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5642 0x1C, 0x1D, 0x1E, 0x1F)); 5643 } 5644 5645 static __inline__ vector unsigned int __ATTRS_o_ai 5646 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5647 return vec_perm(__a, __b, 5648 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5649 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5650 0x1C, 0x1D, 0x1E, 0x1F)); 5651 } 5652 5653 static __inline__ vector bool long long __ATTRS_o_ai 5654 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5655 return vec_mergel(__a, __b); 5656 } 5657 5658 static __inline__ vector signed long long __ATTRS_o_ai 5659 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5660 return vec_mergel(__a, __b); 5661 } 5662 5663 static __inline__ vector unsigned long long __ATTRS_o_ai 5664 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5665 return vec_mergel(__a, __b); 5666 } 5667 5668 static __inline__ vector float __ATTRS_o_ai 5669 vec_mergeo(vector float __a, vector float __b) { 5670 return vec_perm(__a, __b, 5671 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5672 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5673 0x1C, 0x1D, 0x1E, 0x1F)); 5674 } 5675 5676 static __inline__ vector double __ATTRS_o_ai 5677 vec_mergeo(vector double __a, vector double __b) { 5678 return vec_mergel(__a, __b); 5679 } 5680 5681 #endif 5682 5683 /* vec_mfvscr */ 5684 5685 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5686 vec_mfvscr(void) { 5687 return __builtin_altivec_mfvscr(); 5688 } 5689 5690 /* vec_min */ 5691 5692 static __inline__ vector signed char __ATTRS_o_ai 5693 vec_min(vector signed char __a, vector signed char __b) { 5694 return __builtin_altivec_vminsb(__a, __b); 5695 } 5696 5697 static __inline__ vector signed char __ATTRS_o_ai 5698 vec_min(vector bool char __a, vector signed char __b) { 5699 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5700 } 5701 5702 static __inline__ vector signed char __ATTRS_o_ai 5703 vec_min(vector signed char __a, vector bool char __b) { 5704 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5705 } 5706 5707 static __inline__ vector unsigned char __ATTRS_o_ai 5708 vec_min(vector unsigned char __a, vector unsigned char __b) { 5709 return __builtin_altivec_vminub(__a, __b); 5710 } 5711 5712 static __inline__ vector unsigned char __ATTRS_o_ai 5713 vec_min(vector bool char __a, vector unsigned char __b) { 5714 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5715 } 5716 5717 static __inline__ vector unsigned char __ATTRS_o_ai 5718 vec_min(vector unsigned char __a, vector bool char __b) { 5719 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5720 } 5721 5722 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5723 vector short __b) { 5724 return __builtin_altivec_vminsh(__a, __b); 5725 } 5726 5727 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5728 vector short __b) { 5729 return __builtin_altivec_vminsh((vector short)__a, __b); 5730 } 5731 5732 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5733 vector bool short __b) { 5734 return __builtin_altivec_vminsh(__a, (vector short)__b); 5735 } 5736 5737 static __inline__ vector unsigned short __ATTRS_o_ai 5738 vec_min(vector unsigned short __a, vector unsigned short __b) { 5739 return __builtin_altivec_vminuh(__a, __b); 5740 } 5741 5742 static __inline__ vector unsigned short __ATTRS_o_ai 5743 vec_min(vector bool short __a, vector unsigned short __b) { 5744 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5745 } 5746 5747 static __inline__ vector unsigned short __ATTRS_o_ai 5748 vec_min(vector unsigned short __a, vector bool short __b) { 5749 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5750 } 5751 5752 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5753 vector int __b) { 5754 return __builtin_altivec_vminsw(__a, __b); 5755 } 5756 5757 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5758 vector int __b) { 5759 return __builtin_altivec_vminsw((vector int)__a, __b); 5760 } 5761 5762 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5763 vector bool int __b) { 5764 return __builtin_altivec_vminsw(__a, (vector int)__b); 5765 } 5766 5767 static __inline__ vector unsigned int __ATTRS_o_ai 5768 vec_min(vector unsigned int __a, vector unsigned int __b) { 5769 return __builtin_altivec_vminuw(__a, __b); 5770 } 5771 5772 static __inline__ vector unsigned int __ATTRS_o_ai 5773 vec_min(vector bool int __a, vector unsigned int __b) { 5774 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5775 } 5776 5777 static __inline__ vector unsigned int __ATTRS_o_ai 5778 vec_min(vector unsigned int __a, vector bool int __b) { 5779 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5780 } 5781 5782 #ifdef __POWER8_VECTOR__ 5783 static __inline__ vector signed long long __ATTRS_o_ai 5784 vec_min(vector signed long long __a, vector signed long long __b) { 5785 return __builtin_altivec_vminsd(__a, __b); 5786 } 5787 5788 static __inline__ vector signed long long __ATTRS_o_ai 5789 vec_min(vector bool long long __a, vector signed long long __b) { 5790 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5791 } 5792 5793 static __inline__ vector signed long long __ATTRS_o_ai 5794 vec_min(vector signed long long __a, vector bool long long __b) { 5795 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5796 } 5797 5798 static __inline__ vector unsigned long long __ATTRS_o_ai 5799 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5800 return __builtin_altivec_vminud(__a, __b); 5801 } 5802 5803 static __inline__ vector unsigned long long __ATTRS_o_ai 5804 vec_min(vector bool long long __a, vector unsigned long long __b) { 5805 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5806 } 5807 5808 static __inline__ vector unsigned long long __ATTRS_o_ai 5809 vec_min(vector unsigned long long __a, vector bool long long __b) { 5810 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5811 } 5812 #endif 5813 5814 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5815 vector float __b) { 5816 #ifdef __VSX__ 5817 return __builtin_vsx_xvminsp(__a, __b); 5818 #else 5819 return __builtin_altivec_vminfp(__a, __b); 5820 #endif 5821 } 5822 5823 #ifdef __VSX__ 5824 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5825 vector double __b) { 5826 return __builtin_vsx_xvmindp(__a, __b); 5827 } 5828 #endif 5829 5830 /* vec_vminsb */ 5831 5832 static __inline__ vector signed char __ATTRS_o_ai 5833 vec_vminsb(vector signed char __a, vector signed char __b) { 5834 return __builtin_altivec_vminsb(__a, __b); 5835 } 5836 5837 static __inline__ vector signed char __ATTRS_o_ai 5838 vec_vminsb(vector bool char __a, vector signed char __b) { 5839 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5840 } 5841 5842 static __inline__ vector signed char __ATTRS_o_ai 5843 vec_vminsb(vector signed char __a, vector bool char __b) { 5844 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5845 } 5846 5847 /* vec_vminub */ 5848 5849 static __inline__ vector unsigned char __ATTRS_o_ai 5850 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5851 return __builtin_altivec_vminub(__a, __b); 5852 } 5853 5854 static __inline__ vector unsigned char __ATTRS_o_ai 5855 vec_vminub(vector bool char __a, vector unsigned char __b) { 5856 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5857 } 5858 5859 static __inline__ vector unsigned char __ATTRS_o_ai 5860 vec_vminub(vector unsigned char __a, vector bool char __b) { 5861 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5862 } 5863 5864 /* vec_vminsh */ 5865 5866 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5867 vector short __b) { 5868 return __builtin_altivec_vminsh(__a, __b); 5869 } 5870 5871 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5872 vector short __b) { 5873 return __builtin_altivec_vminsh((vector short)__a, __b); 5874 } 5875 5876 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5877 vector bool short __b) { 5878 return __builtin_altivec_vminsh(__a, (vector short)__b); 5879 } 5880 5881 /* vec_vminuh */ 5882 5883 static __inline__ vector unsigned short __ATTRS_o_ai 5884 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5885 return __builtin_altivec_vminuh(__a, __b); 5886 } 5887 5888 static __inline__ vector unsigned short __ATTRS_o_ai 5889 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5890 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5891 } 5892 5893 static __inline__ vector unsigned short __ATTRS_o_ai 5894 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5895 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5896 } 5897 5898 /* vec_vminsw */ 5899 5900 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5901 vector int __b) { 5902 return __builtin_altivec_vminsw(__a, __b); 5903 } 5904 5905 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5906 vector int __b) { 5907 return __builtin_altivec_vminsw((vector int)__a, __b); 5908 } 5909 5910 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5911 vector bool int __b) { 5912 return __builtin_altivec_vminsw(__a, (vector int)__b); 5913 } 5914 5915 /* vec_vminuw */ 5916 5917 static __inline__ vector unsigned int __ATTRS_o_ai 5918 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5919 return __builtin_altivec_vminuw(__a, __b); 5920 } 5921 5922 static __inline__ vector unsigned int __ATTRS_o_ai 5923 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5924 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5925 } 5926 5927 static __inline__ vector unsigned int __ATTRS_o_ai 5928 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5929 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5930 } 5931 5932 /* vec_vminfp */ 5933 5934 static __inline__ vector float __attribute__((__always_inline__)) 5935 vec_vminfp(vector float __a, vector float __b) { 5936 #ifdef __VSX__ 5937 return __builtin_vsx_xvminsp(__a, __b); 5938 #else 5939 return __builtin_altivec_vminfp(__a, __b); 5940 #endif 5941 } 5942 5943 /* vec_mladd */ 5944 5945 #define __builtin_altivec_vmladduhm vec_mladd 5946 5947 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5948 vector short __b, 5949 vector short __c) { 5950 return __a * __b + __c; 5951 } 5952 5953 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5954 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5955 return __a * (vector short)__b + (vector short)__c; 5956 } 5957 5958 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5959 vector short __b, 5960 vector short __c) { 5961 return (vector short)__a * __b + __c; 5962 } 5963 5964 static __inline__ vector unsigned short __ATTRS_o_ai 5965 vec_mladd(vector unsigned short __a, vector unsigned short __b, 5966 vector unsigned short __c) { 5967 return __a * __b + __c; 5968 } 5969 5970 /* vec_vmladduhm */ 5971 5972 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 5973 vector short __b, 5974 vector short __c) { 5975 return __a * __b + __c; 5976 } 5977 5978 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 5979 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5980 return __a * (vector short)__b + (vector short)__c; 5981 } 5982 5983 static __inline__ vector short __ATTRS_o_ai 5984 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 5985 return (vector short)__a * __b + __c; 5986 } 5987 5988 static __inline__ vector unsigned short __ATTRS_o_ai 5989 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 5990 vector unsigned short __c) { 5991 return __a * __b + __c; 5992 } 5993 5994 /* vec_mradds */ 5995 5996 static __inline__ vector short __attribute__((__always_inline__)) 5997 vec_mradds(vector short __a, vector short __b, vector short __c) { 5998 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5999 } 6000 6001 /* vec_vmhraddshs */ 6002 6003 static __inline__ vector short __attribute__((__always_inline__)) 6004 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 6005 return __builtin_altivec_vmhraddshs(__a, __b, __c); 6006 } 6007 6008 /* vec_msum */ 6009 6010 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 6011 vector unsigned char __b, 6012 vector int __c) { 6013 return __builtin_altivec_vmsummbm(__a, __b, __c); 6014 } 6015 6016 static __inline__ vector unsigned int __ATTRS_o_ai 6017 vec_msum(vector unsigned char __a, vector unsigned char __b, 6018 vector unsigned int __c) { 6019 return __builtin_altivec_vmsumubm(__a, __b, __c); 6020 } 6021 6022 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 6023 vector short __b, 6024 vector int __c) { 6025 return __builtin_altivec_vmsumshm(__a, __b, __c); 6026 } 6027 6028 static __inline__ vector unsigned int __ATTRS_o_ai 6029 vec_msum(vector unsigned short __a, vector unsigned short __b, 6030 vector unsigned int __c) { 6031 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6032 } 6033 6034 /* vec_msumc */ 6035 6036 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6037 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6038 vec_msumc(vector unsigned long long __a, vector unsigned long long __b, 6039 vector unsigned __int128 __c) { 6040 return __builtin_altivec_vmsumcud(__a, __b, __c); 6041 } 6042 #endif 6043 6044 /* vec_vmsummbm */ 6045 6046 static __inline__ vector int __attribute__((__always_inline__)) 6047 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 6048 return __builtin_altivec_vmsummbm(__a, __b, __c); 6049 } 6050 6051 /* vec_vmsumubm */ 6052 6053 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6054 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 6055 vector unsigned int __c) { 6056 return __builtin_altivec_vmsumubm(__a, __b, __c); 6057 } 6058 6059 /* vec_vmsumshm */ 6060 6061 static __inline__ vector int __attribute__((__always_inline__)) 6062 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 6063 return __builtin_altivec_vmsumshm(__a, __b, __c); 6064 } 6065 6066 /* vec_vmsumuhm */ 6067 6068 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6069 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 6070 vector unsigned int __c) { 6071 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6072 } 6073 6074 /* vec_msums */ 6075 6076 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 6077 vector short __b, 6078 vector int __c) { 6079 return __builtin_altivec_vmsumshs(__a, __b, __c); 6080 } 6081 6082 static __inline__ vector unsigned int __ATTRS_o_ai 6083 vec_msums(vector unsigned short __a, vector unsigned short __b, 6084 vector unsigned int __c) { 6085 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6086 } 6087 6088 /* vec_vmsumshs */ 6089 6090 static __inline__ vector int __attribute__((__always_inline__)) 6091 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 6092 return __builtin_altivec_vmsumshs(__a, __b, __c); 6093 } 6094 6095 /* vec_vmsumuhs */ 6096 6097 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6098 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 6099 vector unsigned int __c) { 6100 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6101 } 6102 6103 /* vec_mtvscr */ 6104 6105 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 6106 __builtin_altivec_mtvscr((vector int)__a); 6107 } 6108 6109 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 6110 __builtin_altivec_mtvscr((vector int)__a); 6111 } 6112 6113 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 6114 __builtin_altivec_mtvscr((vector int)__a); 6115 } 6116 6117 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 6118 __builtin_altivec_mtvscr((vector int)__a); 6119 } 6120 6121 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 6122 __builtin_altivec_mtvscr((vector int)__a); 6123 } 6124 6125 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 6126 __builtin_altivec_mtvscr((vector int)__a); 6127 } 6128 6129 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 6130 __builtin_altivec_mtvscr((vector int)__a); 6131 } 6132 6133 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 6134 __builtin_altivec_mtvscr((vector int)__a); 6135 } 6136 6137 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 6138 __builtin_altivec_mtvscr((vector int)__a); 6139 } 6140 6141 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 6142 __builtin_altivec_mtvscr((vector int)__a); 6143 } 6144 6145 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 6146 __builtin_altivec_mtvscr((vector int)__a); 6147 } 6148 6149 /* vec_mul */ 6150 6151 /* Integer vector multiplication will involve multiplication of the odd/even 6152 elements separately, then truncating the results and moving to the 6153 result vector. 6154 */ 6155 static __inline__ vector signed char __ATTRS_o_ai 6156 vec_mul(vector signed char __a, vector signed char __b) { 6157 return __a * __b; 6158 } 6159 6160 static __inline__ vector unsigned char __ATTRS_o_ai 6161 vec_mul(vector unsigned char __a, vector unsigned char __b) { 6162 return __a * __b; 6163 } 6164 6165 static __inline__ vector signed short __ATTRS_o_ai 6166 vec_mul(vector signed short __a, vector signed short __b) { 6167 return __a * __b; 6168 } 6169 6170 static __inline__ vector unsigned short __ATTRS_o_ai 6171 vec_mul(vector unsigned short __a, vector unsigned short __b) { 6172 return __a * __b; 6173 } 6174 6175 static __inline__ vector signed int __ATTRS_o_ai 6176 vec_mul(vector signed int __a, vector signed int __b) { 6177 return __a * __b; 6178 } 6179 6180 static __inline__ vector unsigned int __ATTRS_o_ai 6181 vec_mul(vector unsigned int __a, vector unsigned int __b) { 6182 return __a * __b; 6183 } 6184 6185 #ifdef __VSX__ 6186 static __inline__ vector signed long long __ATTRS_o_ai 6187 vec_mul(vector signed long long __a, vector signed long long __b) { 6188 return __a * __b; 6189 } 6190 6191 static __inline__ vector unsigned long long __ATTRS_o_ai 6192 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 6193 return __a * __b; 6194 } 6195 #endif 6196 6197 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 6198 vector float __b) { 6199 return __a * __b; 6200 } 6201 6202 #ifdef __VSX__ 6203 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 6204 vector double __b) { 6205 return __a * __b; 6206 } 6207 #endif 6208 6209 /* The vmulos* and vmules* instructions have a big endian bias, so 6210 we must reverse the meaning of "even" and "odd" for little endian. */ 6211 6212 /* vec_mule */ 6213 6214 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 6215 vector signed char __b) { 6216 #ifdef __LITTLE_ENDIAN__ 6217 return __builtin_altivec_vmulosb(__a, __b); 6218 #else 6219 return __builtin_altivec_vmulesb(__a, __b); 6220 #endif 6221 } 6222 6223 static __inline__ vector unsigned short __ATTRS_o_ai 6224 vec_mule(vector unsigned char __a, vector unsigned char __b) { 6225 #ifdef __LITTLE_ENDIAN__ 6226 return __builtin_altivec_vmuloub(__a, __b); 6227 #else 6228 return __builtin_altivec_vmuleub(__a, __b); 6229 #endif 6230 } 6231 6232 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 6233 vector short __b) { 6234 #ifdef __LITTLE_ENDIAN__ 6235 return __builtin_altivec_vmulosh(__a, __b); 6236 #else 6237 return __builtin_altivec_vmulesh(__a, __b); 6238 #endif 6239 } 6240 6241 static __inline__ vector unsigned int __ATTRS_o_ai 6242 vec_mule(vector unsigned short __a, vector unsigned short __b) { 6243 #ifdef __LITTLE_ENDIAN__ 6244 return __builtin_altivec_vmulouh(__a, __b); 6245 #else 6246 return __builtin_altivec_vmuleuh(__a, __b); 6247 #endif 6248 } 6249 6250 #ifdef __POWER8_VECTOR__ 6251 static __inline__ vector signed long long __ATTRS_o_ai 6252 vec_mule(vector signed int __a, vector signed int __b) { 6253 #ifdef __LITTLE_ENDIAN__ 6254 return __builtin_altivec_vmulosw(__a, __b); 6255 #else 6256 return __builtin_altivec_vmulesw(__a, __b); 6257 #endif 6258 } 6259 6260 static __inline__ vector unsigned long long __ATTRS_o_ai 6261 vec_mule(vector unsigned int __a, vector unsigned int __b) { 6262 #ifdef __LITTLE_ENDIAN__ 6263 return __builtin_altivec_vmulouw(__a, __b); 6264 #else 6265 return __builtin_altivec_vmuleuw(__a, __b); 6266 #endif 6267 } 6268 #endif 6269 6270 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6271 static __inline__ vector signed __int128 __ATTRS_o_ai 6272 vec_mule(vector signed long long __a, vector signed long long __b) { 6273 #ifdef __LITTLE_ENDIAN__ 6274 return __builtin_altivec_vmulosd(__a, __b); 6275 #else 6276 return __builtin_altivec_vmulesd(__a, __b); 6277 #endif 6278 } 6279 6280 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6281 vec_mule(vector unsigned long long __a, vector unsigned long long __b) { 6282 #ifdef __LITTLE_ENDIAN__ 6283 return __builtin_altivec_vmuloud(__a, __b); 6284 #else 6285 return __builtin_altivec_vmuleud(__a, __b); 6286 #endif 6287 } 6288 #endif 6289 6290 /* vec_vmulesb */ 6291 6292 static __inline__ vector short __attribute__((__always_inline__)) 6293 vec_vmulesb(vector signed char __a, vector signed char __b) { 6294 #ifdef __LITTLE_ENDIAN__ 6295 return __builtin_altivec_vmulosb(__a, __b); 6296 #else 6297 return __builtin_altivec_vmulesb(__a, __b); 6298 #endif 6299 } 6300 6301 /* vec_vmuleub */ 6302 6303 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6304 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 6305 #ifdef __LITTLE_ENDIAN__ 6306 return __builtin_altivec_vmuloub(__a, __b); 6307 #else 6308 return __builtin_altivec_vmuleub(__a, __b); 6309 #endif 6310 } 6311 6312 /* vec_vmulesh */ 6313 6314 static __inline__ vector int __attribute__((__always_inline__)) 6315 vec_vmulesh(vector short __a, vector short __b) { 6316 #ifdef __LITTLE_ENDIAN__ 6317 return __builtin_altivec_vmulosh(__a, __b); 6318 #else 6319 return __builtin_altivec_vmulesh(__a, __b); 6320 #endif 6321 } 6322 6323 /* vec_vmuleuh */ 6324 6325 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6326 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 6327 #ifdef __LITTLE_ENDIAN__ 6328 return __builtin_altivec_vmulouh(__a, __b); 6329 #else 6330 return __builtin_altivec_vmuleuh(__a, __b); 6331 #endif 6332 } 6333 6334 /* vec_mulh */ 6335 6336 #ifdef __POWER10_VECTOR__ 6337 static __inline__ vector signed int __ATTRS_o_ai 6338 vec_mulh(vector signed int __a, vector signed int __b) { 6339 return __builtin_altivec_vmulhsw(__a, __b); 6340 } 6341 6342 static __inline__ vector unsigned int __ATTRS_o_ai 6343 vec_mulh(vector unsigned int __a, vector unsigned int __b) { 6344 return __builtin_altivec_vmulhuw(__a, __b); 6345 } 6346 6347 static __inline__ vector signed long long __ATTRS_o_ai 6348 vec_mulh(vector signed long long __a, vector signed long long __b) { 6349 return __builtin_altivec_vmulhsd(__a, __b); 6350 } 6351 6352 static __inline__ vector unsigned long long __ATTRS_o_ai 6353 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { 6354 return __builtin_altivec_vmulhud(__a, __b); 6355 } 6356 #endif 6357 6358 /* vec_mulo */ 6359 6360 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 6361 vector signed char __b) { 6362 #ifdef __LITTLE_ENDIAN__ 6363 return __builtin_altivec_vmulesb(__a, __b); 6364 #else 6365 return __builtin_altivec_vmulosb(__a, __b); 6366 #endif 6367 } 6368 6369 static __inline__ vector unsigned short __ATTRS_o_ai 6370 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 6371 #ifdef __LITTLE_ENDIAN__ 6372 return __builtin_altivec_vmuleub(__a, __b); 6373 #else 6374 return __builtin_altivec_vmuloub(__a, __b); 6375 #endif 6376 } 6377 6378 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 6379 vector short __b) { 6380 #ifdef __LITTLE_ENDIAN__ 6381 return __builtin_altivec_vmulesh(__a, __b); 6382 #else 6383 return __builtin_altivec_vmulosh(__a, __b); 6384 #endif 6385 } 6386 6387 static __inline__ vector unsigned int __ATTRS_o_ai 6388 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 6389 #ifdef __LITTLE_ENDIAN__ 6390 return __builtin_altivec_vmuleuh(__a, __b); 6391 #else 6392 return __builtin_altivec_vmulouh(__a, __b); 6393 #endif 6394 } 6395 6396 #ifdef __POWER8_VECTOR__ 6397 static __inline__ vector signed long long __ATTRS_o_ai 6398 vec_mulo(vector signed int __a, vector signed int __b) { 6399 #ifdef __LITTLE_ENDIAN__ 6400 return __builtin_altivec_vmulesw(__a, __b); 6401 #else 6402 return __builtin_altivec_vmulosw(__a, __b); 6403 #endif 6404 } 6405 6406 static __inline__ vector unsigned long long __ATTRS_o_ai 6407 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 6408 #ifdef __LITTLE_ENDIAN__ 6409 return __builtin_altivec_vmuleuw(__a, __b); 6410 #else 6411 return __builtin_altivec_vmulouw(__a, __b); 6412 #endif 6413 } 6414 #endif 6415 6416 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6417 static __inline__ vector signed __int128 __ATTRS_o_ai 6418 vec_mulo(vector signed long long __a, vector signed long long __b) { 6419 #ifdef __LITTLE_ENDIAN__ 6420 return __builtin_altivec_vmulesd(__a, __b); 6421 #else 6422 return __builtin_altivec_vmulosd(__a, __b); 6423 #endif 6424 } 6425 6426 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6427 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { 6428 #ifdef __LITTLE_ENDIAN__ 6429 return __builtin_altivec_vmuleud(__a, __b); 6430 #else 6431 return __builtin_altivec_vmuloud(__a, __b); 6432 #endif 6433 } 6434 #endif 6435 6436 /* vec_vmulosb */ 6437 6438 static __inline__ vector short __attribute__((__always_inline__)) 6439 vec_vmulosb(vector signed char __a, vector signed char __b) { 6440 #ifdef __LITTLE_ENDIAN__ 6441 return __builtin_altivec_vmulesb(__a, __b); 6442 #else 6443 return __builtin_altivec_vmulosb(__a, __b); 6444 #endif 6445 } 6446 6447 /* vec_vmuloub */ 6448 6449 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6450 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 6451 #ifdef __LITTLE_ENDIAN__ 6452 return __builtin_altivec_vmuleub(__a, __b); 6453 #else 6454 return __builtin_altivec_vmuloub(__a, __b); 6455 #endif 6456 } 6457 6458 /* vec_vmulosh */ 6459 6460 static __inline__ vector int __attribute__((__always_inline__)) 6461 vec_vmulosh(vector short __a, vector short __b) { 6462 #ifdef __LITTLE_ENDIAN__ 6463 return __builtin_altivec_vmulesh(__a, __b); 6464 #else 6465 return __builtin_altivec_vmulosh(__a, __b); 6466 #endif 6467 } 6468 6469 /* vec_vmulouh */ 6470 6471 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6472 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 6473 #ifdef __LITTLE_ENDIAN__ 6474 return __builtin_altivec_vmuleuh(__a, __b); 6475 #else 6476 return __builtin_altivec_vmulouh(__a, __b); 6477 #endif 6478 } 6479 6480 /* vec_nand */ 6481 6482 #ifdef __POWER8_VECTOR__ 6483 static __inline__ vector signed char __ATTRS_o_ai 6484 vec_nand(vector signed char __a, vector signed char __b) { 6485 return ~(__a & __b); 6486 } 6487 6488 static __inline__ vector signed char __ATTRS_o_ai 6489 vec_nand(vector signed char __a, vector bool char __b) { 6490 return ~(__a & __b); 6491 } 6492 6493 static __inline__ vector signed char __ATTRS_o_ai 6494 vec_nand(vector bool char __a, vector signed char __b) { 6495 return ~(__a & __b); 6496 } 6497 6498 static __inline__ vector unsigned char __ATTRS_o_ai 6499 vec_nand(vector unsigned char __a, vector unsigned char __b) { 6500 return ~(__a & __b); 6501 } 6502 6503 static __inline__ vector unsigned char __ATTRS_o_ai 6504 vec_nand(vector unsigned char __a, vector bool char __b) { 6505 return ~(__a & __b); 6506 } 6507 6508 static __inline__ vector unsigned char __ATTRS_o_ai 6509 vec_nand(vector bool char __a, vector unsigned char __b) { 6510 return ~(__a & __b); 6511 } 6512 6513 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 6514 vector bool char __b) { 6515 return ~(__a & __b); 6516 } 6517 6518 static __inline__ vector signed short __ATTRS_o_ai 6519 vec_nand(vector signed short __a, vector signed short __b) { 6520 return ~(__a & __b); 6521 } 6522 6523 static __inline__ vector signed short __ATTRS_o_ai 6524 vec_nand(vector signed short __a, vector bool short __b) { 6525 return ~(__a & __b); 6526 } 6527 6528 static __inline__ vector signed short __ATTRS_o_ai 6529 vec_nand(vector bool short __a, vector signed short __b) { 6530 return ~(__a & __b); 6531 } 6532 6533 static __inline__ vector unsigned short __ATTRS_o_ai 6534 vec_nand(vector unsigned short __a, vector unsigned short __b) { 6535 return ~(__a & __b); 6536 } 6537 6538 static __inline__ vector unsigned short __ATTRS_o_ai 6539 vec_nand(vector unsigned short __a, vector bool short __b) { 6540 return ~(__a & __b); 6541 } 6542 6543 static __inline__ vector bool short __ATTRS_o_ai 6544 vec_nand(vector bool short __a, vector bool short __b) { 6545 return ~(__a & __b); 6546 } 6547 6548 static __inline__ vector signed int __ATTRS_o_ai 6549 vec_nand(vector signed int __a, vector signed int __b) { 6550 return ~(__a & __b); 6551 } 6552 6553 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 6554 vector bool int __b) { 6555 return ~(__a & __b); 6556 } 6557 6558 static __inline__ vector signed int __ATTRS_o_ai 6559 vec_nand(vector bool int __a, vector signed int __b) { 6560 return ~(__a & __b); 6561 } 6562 6563 static __inline__ vector unsigned int __ATTRS_o_ai 6564 vec_nand(vector unsigned int __a, vector unsigned int __b) { 6565 return ~(__a & __b); 6566 } 6567 6568 static __inline__ vector unsigned int __ATTRS_o_ai 6569 vec_nand(vector unsigned int __a, vector bool int __b) { 6570 return ~(__a & __b); 6571 } 6572 6573 static __inline__ vector unsigned int __ATTRS_o_ai 6574 vec_nand(vector bool int __a, vector unsigned int __b) { 6575 return ~(__a & __b); 6576 } 6577 6578 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 6579 vector bool int __b) { 6580 return ~(__a & __b); 6581 } 6582 6583 static __inline__ vector float __ATTRS_o_ai 6584 vec_nand(vector float __a, vector float __b) { 6585 return (vector float)(~((vector unsigned int)__a & 6586 (vector unsigned int)__b)); 6587 } 6588 6589 static __inline__ vector signed long long __ATTRS_o_ai 6590 vec_nand(vector signed long long __a, vector signed long long __b) { 6591 return ~(__a & __b); 6592 } 6593 6594 static __inline__ vector signed long long __ATTRS_o_ai 6595 vec_nand(vector signed long long __a, vector bool long long __b) { 6596 return ~(__a & __b); 6597 } 6598 6599 static __inline__ vector signed long long __ATTRS_o_ai 6600 vec_nand(vector bool long long __a, vector signed long long __b) { 6601 return ~(__a & __b); 6602 } 6603 6604 static __inline__ vector unsigned long long __ATTRS_o_ai 6605 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6606 return ~(__a & __b); 6607 } 6608 6609 static __inline__ vector unsigned long long __ATTRS_o_ai 6610 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6611 return ~(__a & __b); 6612 } 6613 6614 static __inline__ vector unsigned long long __ATTRS_o_ai 6615 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6616 return ~(__a & __b); 6617 } 6618 6619 static __inline__ vector bool long long __ATTRS_o_ai 6620 vec_nand(vector bool long long __a, vector bool long long __b) { 6621 return ~(__a & __b); 6622 } 6623 6624 static __inline__ vector double __ATTRS_o_ai 6625 vec_nand(vector double __a, vector double __b) { 6626 return (vector double)(~((vector unsigned long long)__a & 6627 (vector unsigned long long)__b)); 6628 } 6629 6630 #endif 6631 6632 /* vec_nmadd */ 6633 6634 #ifdef __VSX__ 6635 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6636 vector float __b, 6637 vector float __c) { 6638 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6639 } 6640 6641 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6642 vector double __b, 6643 vector double __c) { 6644 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6645 } 6646 #endif 6647 6648 /* vec_nmsub */ 6649 6650 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6651 vector float __b, 6652 vector float __c) { 6653 #ifdef __VSX__ 6654 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6655 #else 6656 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6657 #endif 6658 } 6659 6660 #ifdef __VSX__ 6661 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6662 vector double __b, 6663 vector double __c) { 6664 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6665 } 6666 #endif 6667 6668 /* vec_vnmsubfp */ 6669 6670 static __inline__ vector float __attribute__((__always_inline__)) 6671 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6672 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6673 } 6674 6675 /* vec_nor */ 6676 6677 #define __builtin_altivec_vnor vec_nor 6678 6679 static __inline__ vector signed char __ATTRS_o_ai 6680 vec_nor(vector signed char __a, vector signed char __b) { 6681 return ~(__a | __b); 6682 } 6683 6684 static __inline__ vector unsigned char __ATTRS_o_ai 6685 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6686 return ~(__a | __b); 6687 } 6688 6689 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6690 vector bool char __b) { 6691 return ~(__a | __b); 6692 } 6693 6694 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6695 vector short __b) { 6696 return ~(__a | __b); 6697 } 6698 6699 static __inline__ vector unsigned short __ATTRS_o_ai 6700 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6701 return ~(__a | __b); 6702 } 6703 6704 static __inline__ vector bool short __ATTRS_o_ai 6705 vec_nor(vector bool short __a, vector bool short __b) { 6706 return ~(__a | __b); 6707 } 6708 6709 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6710 vector int __b) { 6711 return ~(__a | __b); 6712 } 6713 6714 static __inline__ vector unsigned int __ATTRS_o_ai 6715 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6716 return ~(__a | __b); 6717 } 6718 6719 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6720 vector bool int __b) { 6721 return ~(__a | __b); 6722 } 6723 6724 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6725 vector float __b) { 6726 vector unsigned int __res = 6727 ~((vector unsigned int)__a | (vector unsigned int)__b); 6728 return (vector float)__res; 6729 } 6730 6731 #ifdef __VSX__ 6732 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6733 vector double __b) { 6734 vector unsigned long long __res = 6735 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6736 return (vector double)__res; 6737 } 6738 #endif 6739 6740 /* vec_vnor */ 6741 6742 static __inline__ vector signed char __ATTRS_o_ai 6743 vec_vnor(vector signed char __a, vector signed char __b) { 6744 return ~(__a | __b); 6745 } 6746 6747 static __inline__ vector unsigned char __ATTRS_o_ai 6748 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6749 return ~(__a | __b); 6750 } 6751 6752 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6753 vector bool char __b) { 6754 return ~(__a | __b); 6755 } 6756 6757 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6758 vector short __b) { 6759 return ~(__a | __b); 6760 } 6761 6762 static __inline__ vector unsigned short __ATTRS_o_ai 6763 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6764 return ~(__a | __b); 6765 } 6766 6767 static __inline__ vector bool short __ATTRS_o_ai 6768 vec_vnor(vector bool short __a, vector bool short __b) { 6769 return ~(__a | __b); 6770 } 6771 6772 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6773 vector int __b) { 6774 return ~(__a | __b); 6775 } 6776 6777 static __inline__ vector unsigned int __ATTRS_o_ai 6778 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6779 return ~(__a | __b); 6780 } 6781 6782 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6783 vector bool int __b) { 6784 return ~(__a | __b); 6785 } 6786 6787 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6788 vector float __b) { 6789 vector unsigned int __res = 6790 ~((vector unsigned int)__a | (vector unsigned int)__b); 6791 return (vector float)__res; 6792 } 6793 6794 #ifdef __VSX__ 6795 static __inline__ vector signed long long __ATTRS_o_ai 6796 vec_nor(vector signed long long __a, vector signed long long __b) { 6797 return ~(__a | __b); 6798 } 6799 6800 static __inline__ vector unsigned long long __ATTRS_o_ai 6801 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6802 return ~(__a | __b); 6803 } 6804 6805 static __inline__ vector bool long long __ATTRS_o_ai 6806 vec_nor(vector bool long long __a, vector bool long long __b) { 6807 return ~(__a | __b); 6808 } 6809 #endif 6810 6811 /* vec_or */ 6812 6813 #define __builtin_altivec_vor vec_or 6814 6815 static __inline__ vector signed char __ATTRS_o_ai 6816 vec_or(vector signed char __a, vector signed char __b) { 6817 return __a | __b; 6818 } 6819 6820 static __inline__ vector signed char __ATTRS_o_ai 6821 vec_or(vector bool char __a, vector signed char __b) { 6822 return (vector signed char)__a | __b; 6823 } 6824 6825 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6826 vector bool char __b) { 6827 return __a | (vector signed char)__b; 6828 } 6829 6830 static __inline__ vector unsigned char __ATTRS_o_ai 6831 vec_or(vector unsigned char __a, vector unsigned char __b) { 6832 return __a | __b; 6833 } 6834 6835 static __inline__ vector unsigned char __ATTRS_o_ai 6836 vec_or(vector bool char __a, vector unsigned char __b) { 6837 return (vector unsigned char)__a | __b; 6838 } 6839 6840 static __inline__ vector unsigned char __ATTRS_o_ai 6841 vec_or(vector unsigned char __a, vector bool char __b) { 6842 return __a | (vector unsigned char)__b; 6843 } 6844 6845 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6846 vector bool char __b) { 6847 return __a | __b; 6848 } 6849 6850 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6851 vector short __b) { 6852 return __a | __b; 6853 } 6854 6855 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6856 vector short __b) { 6857 return (vector short)__a | __b; 6858 } 6859 6860 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6861 vector bool short __b) { 6862 return __a | (vector short)__b; 6863 } 6864 6865 static __inline__ vector unsigned short __ATTRS_o_ai 6866 vec_or(vector unsigned short __a, vector unsigned short __b) { 6867 return __a | __b; 6868 } 6869 6870 static __inline__ vector unsigned short __ATTRS_o_ai 6871 vec_or(vector bool short __a, vector unsigned short __b) { 6872 return (vector unsigned short)__a | __b; 6873 } 6874 6875 static __inline__ vector unsigned short __ATTRS_o_ai 6876 vec_or(vector unsigned short __a, vector bool short __b) { 6877 return __a | (vector unsigned short)__b; 6878 } 6879 6880 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6881 vector bool short __b) { 6882 return __a | __b; 6883 } 6884 6885 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6886 vector int __b) { 6887 return __a | __b; 6888 } 6889 6890 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6891 vector int __b) { 6892 return (vector int)__a | __b; 6893 } 6894 6895 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6896 vector bool int __b) { 6897 return __a | (vector int)__b; 6898 } 6899 6900 static __inline__ vector unsigned int __ATTRS_o_ai 6901 vec_or(vector unsigned int __a, vector unsigned int __b) { 6902 return __a | __b; 6903 } 6904 6905 static __inline__ vector unsigned int __ATTRS_o_ai 6906 vec_or(vector bool int __a, vector unsigned int __b) { 6907 return (vector unsigned int)__a | __b; 6908 } 6909 6910 static __inline__ vector unsigned int __ATTRS_o_ai 6911 vec_or(vector unsigned int __a, vector bool int __b) { 6912 return __a | (vector unsigned int)__b; 6913 } 6914 6915 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6916 vector bool int __b) { 6917 return __a | __b; 6918 } 6919 6920 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6921 vector float __b) { 6922 vector unsigned int __res = 6923 (vector unsigned int)__a | (vector unsigned int)__b; 6924 return (vector float)__res; 6925 } 6926 6927 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6928 vector float __b) { 6929 vector unsigned int __res = 6930 (vector unsigned int)__a | (vector unsigned int)__b; 6931 return (vector float)__res; 6932 } 6933 6934 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6935 vector bool int __b) { 6936 vector unsigned int __res = 6937 (vector unsigned int)__a | (vector unsigned int)__b; 6938 return (vector float)__res; 6939 } 6940 6941 #ifdef __VSX__ 6942 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6943 vector double __b) { 6944 return (vector double)((vector unsigned long long)__a | 6945 (vector unsigned long long)__b); 6946 } 6947 6948 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6949 vector bool long long __b) { 6950 return (vector double)((vector unsigned long long)__a | 6951 (vector unsigned long long)__b); 6952 } 6953 6954 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6955 vector double __b) { 6956 return (vector double)((vector unsigned long long)__a | 6957 (vector unsigned long long)__b); 6958 } 6959 6960 static __inline__ vector signed long long __ATTRS_o_ai 6961 vec_or(vector signed long long __a, vector signed long long __b) { 6962 return __a | __b; 6963 } 6964 6965 static __inline__ vector signed long long __ATTRS_o_ai 6966 vec_or(vector bool long long __a, vector signed long long __b) { 6967 return (vector signed long long)__a | __b; 6968 } 6969 6970 static __inline__ vector signed long long __ATTRS_o_ai 6971 vec_or(vector signed long long __a, vector bool long long __b) { 6972 return __a | (vector signed long long)__b; 6973 } 6974 6975 static __inline__ vector unsigned long long __ATTRS_o_ai 6976 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 6977 return __a | __b; 6978 } 6979 6980 static __inline__ vector unsigned long long __ATTRS_o_ai 6981 vec_or(vector bool long long __a, vector unsigned long long __b) { 6982 return (vector unsigned long long)__a | __b; 6983 } 6984 6985 static __inline__ vector unsigned long long __ATTRS_o_ai 6986 vec_or(vector unsigned long long __a, vector bool long long __b) { 6987 return __a | (vector unsigned long long)__b; 6988 } 6989 6990 static __inline__ vector bool long long __ATTRS_o_ai 6991 vec_or(vector bool long long __a, vector bool long long __b) { 6992 return __a | __b; 6993 } 6994 #endif 6995 6996 #ifdef __POWER8_VECTOR__ 6997 static __inline__ vector signed char __ATTRS_o_ai 6998 vec_orc(vector signed char __a, vector signed char __b) { 6999 return __a | ~__b; 7000 } 7001 7002 static __inline__ vector signed char __ATTRS_o_ai 7003 vec_orc(vector signed char __a, vector bool char __b) { 7004 return __a | ~__b; 7005 } 7006 7007 static __inline__ vector signed char __ATTRS_o_ai 7008 vec_orc(vector bool char __a, vector signed char __b) { 7009 return __a | ~__b; 7010 } 7011 7012 static __inline__ vector unsigned char __ATTRS_o_ai 7013 vec_orc(vector unsigned char __a, vector unsigned char __b) { 7014 return __a | ~__b; 7015 } 7016 7017 static __inline__ vector unsigned char __ATTRS_o_ai 7018 vec_orc(vector unsigned char __a, vector bool char __b) { 7019 return __a | ~__b; 7020 } 7021 7022 static __inline__ vector unsigned char __ATTRS_o_ai 7023 vec_orc(vector bool char __a, vector unsigned char __b) { 7024 return __a | ~__b; 7025 } 7026 7027 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 7028 vector bool char __b) { 7029 return __a | ~__b; 7030 } 7031 7032 static __inline__ vector signed short __ATTRS_o_ai 7033 vec_orc(vector signed short __a, vector signed short __b) { 7034 return __a | ~__b; 7035 } 7036 7037 static __inline__ vector signed short __ATTRS_o_ai 7038 vec_orc(vector signed short __a, vector bool short __b) { 7039 return __a | ~__b; 7040 } 7041 7042 static __inline__ vector signed short __ATTRS_o_ai 7043 vec_orc(vector bool short __a, vector signed short __b) { 7044 return __a | ~__b; 7045 } 7046 7047 static __inline__ vector unsigned short __ATTRS_o_ai 7048 vec_orc(vector unsigned short __a, vector unsigned short __b) { 7049 return __a | ~__b; 7050 } 7051 7052 static __inline__ vector unsigned short __ATTRS_o_ai 7053 vec_orc(vector unsigned short __a, vector bool short __b) { 7054 return __a | ~__b; 7055 } 7056 7057 static __inline__ vector unsigned short __ATTRS_o_ai 7058 vec_orc(vector bool short __a, vector unsigned short __b) { 7059 return __a | ~__b; 7060 } 7061 7062 static __inline__ vector bool short __ATTRS_o_ai 7063 vec_orc(vector bool short __a, vector bool short __b) { 7064 return __a | ~__b; 7065 } 7066 7067 static __inline__ vector signed int __ATTRS_o_ai 7068 vec_orc(vector signed int __a, vector signed int __b) { 7069 return __a | ~__b; 7070 } 7071 7072 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 7073 vector bool int __b) { 7074 return __a | ~__b; 7075 } 7076 7077 static __inline__ vector signed int __ATTRS_o_ai 7078 vec_orc(vector bool int __a, vector signed int __b) { 7079 return __a | ~__b; 7080 } 7081 7082 static __inline__ vector unsigned int __ATTRS_o_ai 7083 vec_orc(vector unsigned int __a, vector unsigned int __b) { 7084 return __a | ~__b; 7085 } 7086 7087 static __inline__ vector unsigned int __ATTRS_o_ai 7088 vec_orc(vector unsigned int __a, vector bool int __b) { 7089 return __a | ~__b; 7090 } 7091 7092 static __inline__ vector unsigned int __ATTRS_o_ai 7093 vec_orc(vector bool int __a, vector unsigned int __b) { 7094 return __a | ~__b; 7095 } 7096 7097 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 7098 vector bool int __b) { 7099 return __a | ~__b; 7100 } 7101 7102 static __inline__ vector float __ATTRS_o_ai 7103 vec_orc(vector bool int __a, vector float __b) { 7104 return (vector float)(__a | ~(vector unsigned int)__b); 7105 } 7106 7107 static __inline__ vector float __ATTRS_o_ai 7108 vec_orc(vector float __a, vector bool int __b) { 7109 return (vector float)((vector unsigned int)__a | ~__b); 7110 } 7111 7112 static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a, 7113 vector float __b) { 7114 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b); 7115 } 7116 7117 static __inline__ vector signed long long __ATTRS_o_ai 7118 vec_orc(vector signed long long __a, vector signed long long __b) { 7119 return __a | ~__b; 7120 } 7121 7122 static __inline__ vector signed long long __ATTRS_o_ai 7123 vec_orc(vector signed long long __a, vector bool long long __b) { 7124 return __a | ~__b; 7125 } 7126 7127 static __inline__ vector signed long long __ATTRS_o_ai 7128 vec_orc(vector bool long long __a, vector signed long long __b) { 7129 return __a | ~__b; 7130 } 7131 7132 static __inline__ vector unsigned long long __ATTRS_o_ai 7133 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 7134 return __a | ~__b; 7135 } 7136 7137 static __inline__ vector unsigned long long __ATTRS_o_ai 7138 vec_orc(vector unsigned long long __a, vector bool long long __b) { 7139 return __a | ~__b; 7140 } 7141 7142 static __inline__ vector unsigned long long __ATTRS_o_ai 7143 vec_orc(vector bool long long __a, vector unsigned long long __b) { 7144 return __a | ~__b; 7145 } 7146 7147 static __inline__ vector bool long long __ATTRS_o_ai 7148 vec_orc(vector bool long long __a, vector bool long long __b) { 7149 return __a | ~__b; 7150 } 7151 7152 static __inline__ vector double __ATTRS_o_ai 7153 vec_orc(vector double __a, vector bool long long __b) { 7154 return (vector double)((vector unsigned long long)__a | ~__b); 7155 } 7156 7157 static __inline__ vector double __ATTRS_o_ai 7158 vec_orc(vector bool long long __a, vector double __b) { 7159 return (vector double)(__a | ~(vector unsigned long long)__b); 7160 } 7161 7162 static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a, 7163 vector double __b) { 7164 return (vector double)((vector bool long long)__a | 7165 ~(vector unsigned long long)__b); 7166 } 7167 #endif 7168 7169 /* vec_vor */ 7170 7171 static __inline__ vector signed char __ATTRS_o_ai 7172 vec_vor(vector signed char __a, vector signed char __b) { 7173 return __a | __b; 7174 } 7175 7176 static __inline__ vector signed char __ATTRS_o_ai 7177 vec_vor(vector bool char __a, vector signed char __b) { 7178 return (vector signed char)__a | __b; 7179 } 7180 7181 static __inline__ vector signed char __ATTRS_o_ai 7182 vec_vor(vector signed char __a, vector bool char __b) { 7183 return __a | (vector signed char)__b; 7184 } 7185 7186 static __inline__ vector unsigned char __ATTRS_o_ai 7187 vec_vor(vector unsigned char __a, vector unsigned char __b) { 7188 return __a | __b; 7189 } 7190 7191 static __inline__ vector unsigned char __ATTRS_o_ai 7192 vec_vor(vector bool char __a, vector unsigned char __b) { 7193 return (vector unsigned char)__a | __b; 7194 } 7195 7196 static __inline__ vector unsigned char __ATTRS_o_ai 7197 vec_vor(vector unsigned char __a, vector bool char __b) { 7198 return __a | (vector unsigned char)__b; 7199 } 7200 7201 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 7202 vector bool char __b) { 7203 return __a | __b; 7204 } 7205 7206 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7207 vector short __b) { 7208 return __a | __b; 7209 } 7210 7211 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 7212 vector short __b) { 7213 return (vector short)__a | __b; 7214 } 7215 7216 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7217 vector bool short __b) { 7218 return __a | (vector short)__b; 7219 } 7220 7221 static __inline__ vector unsigned short __ATTRS_o_ai 7222 vec_vor(vector unsigned short __a, vector unsigned short __b) { 7223 return __a | __b; 7224 } 7225 7226 static __inline__ vector unsigned short __ATTRS_o_ai 7227 vec_vor(vector bool short __a, vector unsigned short __b) { 7228 return (vector unsigned short)__a | __b; 7229 } 7230 7231 static __inline__ vector unsigned short __ATTRS_o_ai 7232 vec_vor(vector unsigned short __a, vector bool short __b) { 7233 return __a | (vector unsigned short)__b; 7234 } 7235 7236 static __inline__ vector bool short __ATTRS_o_ai 7237 vec_vor(vector bool short __a, vector bool short __b) { 7238 return __a | __b; 7239 } 7240 7241 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7242 vector int __b) { 7243 return __a | __b; 7244 } 7245 7246 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 7247 vector int __b) { 7248 return (vector int)__a | __b; 7249 } 7250 7251 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7252 vector bool int __b) { 7253 return __a | (vector int)__b; 7254 } 7255 7256 static __inline__ vector unsigned int __ATTRS_o_ai 7257 vec_vor(vector unsigned int __a, vector unsigned int __b) { 7258 return __a | __b; 7259 } 7260 7261 static __inline__ vector unsigned int __ATTRS_o_ai 7262 vec_vor(vector bool int __a, vector unsigned int __b) { 7263 return (vector unsigned int)__a | __b; 7264 } 7265 7266 static __inline__ vector unsigned int __ATTRS_o_ai 7267 vec_vor(vector unsigned int __a, vector bool int __b) { 7268 return __a | (vector unsigned int)__b; 7269 } 7270 7271 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 7272 vector bool int __b) { 7273 return __a | __b; 7274 } 7275 7276 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7277 vector float __b) { 7278 vector unsigned int __res = 7279 (vector unsigned int)__a | (vector unsigned int)__b; 7280 return (vector float)__res; 7281 } 7282 7283 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 7284 vector float __b) { 7285 vector unsigned int __res = 7286 (vector unsigned int)__a | (vector unsigned int)__b; 7287 return (vector float)__res; 7288 } 7289 7290 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7291 vector bool int __b) { 7292 vector unsigned int __res = 7293 (vector unsigned int)__a | (vector unsigned int)__b; 7294 return (vector float)__res; 7295 } 7296 7297 #ifdef __VSX__ 7298 static __inline__ vector signed long long __ATTRS_o_ai 7299 vec_vor(vector signed long long __a, vector signed long long __b) { 7300 return __a | __b; 7301 } 7302 7303 static __inline__ vector signed long long __ATTRS_o_ai 7304 vec_vor(vector bool long long __a, vector signed long long __b) { 7305 return (vector signed long long)__a | __b; 7306 } 7307 7308 static __inline__ vector signed long long __ATTRS_o_ai 7309 vec_vor(vector signed long long __a, vector bool long long __b) { 7310 return __a | (vector signed long long)__b; 7311 } 7312 7313 static __inline__ vector unsigned long long __ATTRS_o_ai 7314 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 7315 return __a | __b; 7316 } 7317 7318 static __inline__ vector unsigned long long __ATTRS_o_ai 7319 vec_vor(vector bool long long __a, vector unsigned long long __b) { 7320 return (vector unsigned long long)__a | __b; 7321 } 7322 7323 static __inline__ vector unsigned long long __ATTRS_o_ai 7324 vec_vor(vector unsigned long long __a, vector bool long long __b) { 7325 return __a | (vector unsigned long long)__b; 7326 } 7327 7328 static __inline__ vector bool long long __ATTRS_o_ai 7329 vec_vor(vector bool long long __a, vector bool long long __b) { 7330 return __a | __b; 7331 } 7332 #endif 7333 7334 /* vec_pack */ 7335 7336 /* The various vector pack instructions have a big-endian bias, so for 7337 little endian we must handle reversed element numbering. */ 7338 7339 static __inline__ vector signed char __ATTRS_o_ai 7340 vec_pack(vector signed short __a, vector signed short __b) { 7341 #ifdef __LITTLE_ENDIAN__ 7342 return (vector signed char)vec_perm( 7343 __a, __b, 7344 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7345 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7346 #else 7347 return (vector signed char)vec_perm( 7348 __a, __b, 7349 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7350 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7351 #endif 7352 } 7353 7354 static __inline__ vector unsigned char __ATTRS_o_ai 7355 vec_pack(vector unsigned short __a, vector unsigned short __b) { 7356 #ifdef __LITTLE_ENDIAN__ 7357 return (vector unsigned char)vec_perm( 7358 __a, __b, 7359 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7360 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7361 #else 7362 return (vector unsigned char)vec_perm( 7363 __a, __b, 7364 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7365 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7366 #endif 7367 } 7368 7369 static __inline__ vector bool char __ATTRS_o_ai 7370 vec_pack(vector bool short __a, vector bool short __b) { 7371 #ifdef __LITTLE_ENDIAN__ 7372 return (vector bool char)vec_perm( 7373 __a, __b, 7374 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7375 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7376 #else 7377 return (vector bool char)vec_perm( 7378 __a, __b, 7379 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7380 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7381 #endif 7382 } 7383 7384 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 7385 vector int __b) { 7386 #ifdef __LITTLE_ENDIAN__ 7387 return (vector short)vec_perm( 7388 __a, __b, 7389 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7390 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7391 #else 7392 return (vector short)vec_perm( 7393 __a, __b, 7394 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7395 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7396 #endif 7397 } 7398 7399 static __inline__ vector unsigned short __ATTRS_o_ai 7400 vec_pack(vector unsigned int __a, vector unsigned int __b) { 7401 #ifdef __LITTLE_ENDIAN__ 7402 return (vector unsigned short)vec_perm( 7403 __a, __b, 7404 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7405 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7406 #else 7407 return (vector unsigned short)vec_perm( 7408 __a, __b, 7409 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7410 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7411 #endif 7412 } 7413 7414 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 7415 vector bool int __b) { 7416 #ifdef __LITTLE_ENDIAN__ 7417 return (vector bool short)vec_perm( 7418 __a, __b, 7419 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7420 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7421 #else 7422 return (vector bool short)vec_perm( 7423 __a, __b, 7424 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7425 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7426 #endif 7427 } 7428 7429 #ifdef __VSX__ 7430 static __inline__ vector signed int __ATTRS_o_ai 7431 vec_pack(vector signed long long __a, vector signed long long __b) { 7432 #ifdef __LITTLE_ENDIAN__ 7433 return (vector signed int)vec_perm( 7434 __a, __b, 7435 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7436 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7437 #else 7438 return (vector signed int)vec_perm( 7439 __a, __b, 7440 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7441 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7442 #endif 7443 } 7444 static __inline__ vector unsigned int __ATTRS_o_ai 7445 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 7446 #ifdef __LITTLE_ENDIAN__ 7447 return (vector unsigned int)vec_perm( 7448 __a, __b, 7449 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7450 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7451 #else 7452 return (vector unsigned int)vec_perm( 7453 __a, __b, 7454 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7455 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7456 #endif 7457 } 7458 7459 static __inline__ vector bool int __ATTRS_o_ai 7460 vec_pack(vector bool long long __a, vector bool long long __b) { 7461 #ifdef __LITTLE_ENDIAN__ 7462 return (vector bool int)vec_perm( 7463 __a, __b, 7464 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7465 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7466 #else 7467 return (vector bool int)vec_perm( 7468 __a, __b, 7469 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7470 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7471 #endif 7472 } 7473 7474 static __inline__ vector float __ATTRS_o_ai 7475 vec_pack(vector double __a, vector double __b) { 7476 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 7477 } 7478 #endif 7479 7480 #ifdef __POWER9_VECTOR__ 7481 static __inline__ vector unsigned short __ATTRS_o_ai 7482 vec_pack_to_short_fp32(vector float __a, vector float __b) { 7483 vector float __resa = __builtin_vsx_xvcvsphp(__a); 7484 vector float __resb = __builtin_vsx_xvcvsphp(__b); 7485 #ifdef __LITTLE_ENDIAN__ 7486 return (vector unsigned short)vec_mergee(__resa, __resb); 7487 #else 7488 return (vector unsigned short)vec_mergeo(__resa, __resb); 7489 #endif 7490 } 7491 7492 #endif 7493 /* vec_vpkuhum */ 7494 7495 #define __builtin_altivec_vpkuhum vec_vpkuhum 7496 7497 static __inline__ vector signed char __ATTRS_o_ai 7498 vec_vpkuhum(vector signed short __a, vector signed short __b) { 7499 #ifdef __LITTLE_ENDIAN__ 7500 return (vector signed char)vec_perm( 7501 __a, __b, 7502 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7503 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7504 #else 7505 return (vector signed char)vec_perm( 7506 __a, __b, 7507 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7508 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7509 #endif 7510 } 7511 7512 static __inline__ vector unsigned char __ATTRS_o_ai 7513 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 7514 #ifdef __LITTLE_ENDIAN__ 7515 return (vector unsigned char)vec_perm( 7516 __a, __b, 7517 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7518 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7519 #else 7520 return (vector unsigned char)vec_perm( 7521 __a, __b, 7522 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7523 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7524 #endif 7525 } 7526 7527 static __inline__ vector bool char __ATTRS_o_ai 7528 vec_vpkuhum(vector bool short __a, vector bool short __b) { 7529 #ifdef __LITTLE_ENDIAN__ 7530 return (vector bool char)vec_perm( 7531 __a, __b, 7532 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7533 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7534 #else 7535 return (vector bool char)vec_perm( 7536 __a, __b, 7537 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7538 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7539 #endif 7540 } 7541 7542 /* vec_vpkuwum */ 7543 7544 #define __builtin_altivec_vpkuwum vec_vpkuwum 7545 7546 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 7547 vector int __b) { 7548 #ifdef __LITTLE_ENDIAN__ 7549 return (vector short)vec_perm( 7550 __a, __b, 7551 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7552 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7553 #else 7554 return (vector short)vec_perm( 7555 __a, __b, 7556 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7557 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7558 #endif 7559 } 7560 7561 static __inline__ vector unsigned short __ATTRS_o_ai 7562 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 7563 #ifdef __LITTLE_ENDIAN__ 7564 return (vector unsigned short)vec_perm( 7565 __a, __b, 7566 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7567 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7568 #else 7569 return (vector unsigned short)vec_perm( 7570 __a, __b, 7571 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7572 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7573 #endif 7574 } 7575 7576 static __inline__ vector bool short __ATTRS_o_ai 7577 vec_vpkuwum(vector bool int __a, vector bool int __b) { 7578 #ifdef __LITTLE_ENDIAN__ 7579 return (vector bool short)vec_perm( 7580 __a, __b, 7581 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7582 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7583 #else 7584 return (vector bool short)vec_perm( 7585 __a, __b, 7586 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7587 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7588 #endif 7589 } 7590 7591 /* vec_vpkudum */ 7592 7593 #ifdef __POWER8_VECTOR__ 7594 #define __builtin_altivec_vpkudum vec_vpkudum 7595 7596 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7597 vector long long __b) { 7598 #ifdef __LITTLE_ENDIAN__ 7599 return (vector int)vec_perm( 7600 __a, __b, 7601 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7602 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7603 #else 7604 return (vector int)vec_perm( 7605 __a, __b, 7606 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7607 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7608 #endif 7609 } 7610 7611 static __inline__ vector unsigned int __ATTRS_o_ai 7612 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7613 #ifdef __LITTLE_ENDIAN__ 7614 return (vector unsigned int)vec_perm( 7615 __a, __b, 7616 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7617 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7618 #else 7619 return (vector unsigned int)vec_perm( 7620 __a, __b, 7621 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7622 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7623 #endif 7624 } 7625 7626 static __inline__ vector bool int __ATTRS_o_ai 7627 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7628 #ifdef __LITTLE_ENDIAN__ 7629 return (vector bool int)vec_perm( 7630 (vector long long)__a, (vector long long)__b, 7631 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7632 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7633 #else 7634 return (vector bool int)vec_perm( 7635 (vector long long)__a, (vector long long)__b, 7636 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7637 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7638 #endif 7639 } 7640 #endif 7641 7642 /* vec_packpx */ 7643 7644 static __inline__ vector pixel __attribute__((__always_inline__)) 7645 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7646 #ifdef __LITTLE_ENDIAN__ 7647 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7648 #else 7649 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7650 #endif 7651 } 7652 7653 /* vec_vpkpx */ 7654 7655 static __inline__ vector pixel __attribute__((__always_inline__)) 7656 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7657 #ifdef __LITTLE_ENDIAN__ 7658 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7659 #else 7660 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7661 #endif 7662 } 7663 7664 /* vec_packs */ 7665 7666 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7667 vector short __b) { 7668 #ifdef __LITTLE_ENDIAN__ 7669 return __builtin_altivec_vpkshss(__b, __a); 7670 #else 7671 return __builtin_altivec_vpkshss(__a, __b); 7672 #endif 7673 } 7674 7675 static __inline__ vector unsigned char __ATTRS_o_ai 7676 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7677 #ifdef __LITTLE_ENDIAN__ 7678 return __builtin_altivec_vpkuhus(__b, __a); 7679 #else 7680 return __builtin_altivec_vpkuhus(__a, __b); 7681 #endif 7682 } 7683 7684 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7685 vector int __b) { 7686 #ifdef __LITTLE_ENDIAN__ 7687 return __builtin_altivec_vpkswss(__b, __a); 7688 #else 7689 return __builtin_altivec_vpkswss(__a, __b); 7690 #endif 7691 } 7692 7693 static __inline__ vector unsigned short __ATTRS_o_ai 7694 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7695 #ifdef __LITTLE_ENDIAN__ 7696 return __builtin_altivec_vpkuwus(__b, __a); 7697 #else 7698 return __builtin_altivec_vpkuwus(__a, __b); 7699 #endif 7700 } 7701 7702 #ifdef __POWER8_VECTOR__ 7703 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7704 vector long long __b) { 7705 #ifdef __LITTLE_ENDIAN__ 7706 return __builtin_altivec_vpksdss(__b, __a); 7707 #else 7708 return __builtin_altivec_vpksdss(__a, __b); 7709 #endif 7710 } 7711 7712 static __inline__ vector unsigned int __ATTRS_o_ai 7713 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7714 #ifdef __LITTLE_ENDIAN__ 7715 return __builtin_altivec_vpkudus(__b, __a); 7716 #else 7717 return __builtin_altivec_vpkudus(__a, __b); 7718 #endif 7719 } 7720 #endif 7721 7722 /* vec_vpkshss */ 7723 7724 static __inline__ vector signed char __attribute__((__always_inline__)) 7725 vec_vpkshss(vector short __a, vector short __b) { 7726 #ifdef __LITTLE_ENDIAN__ 7727 return __builtin_altivec_vpkshss(__b, __a); 7728 #else 7729 return __builtin_altivec_vpkshss(__a, __b); 7730 #endif 7731 } 7732 7733 /* vec_vpksdss */ 7734 7735 #ifdef __POWER8_VECTOR__ 7736 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7737 vector long long __b) { 7738 #ifdef __LITTLE_ENDIAN__ 7739 return __builtin_altivec_vpksdss(__b, __a); 7740 #else 7741 return __builtin_altivec_vpksdss(__a, __b); 7742 #endif 7743 } 7744 #endif 7745 7746 /* vec_vpkuhus */ 7747 7748 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7749 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7750 #ifdef __LITTLE_ENDIAN__ 7751 return __builtin_altivec_vpkuhus(__b, __a); 7752 #else 7753 return __builtin_altivec_vpkuhus(__a, __b); 7754 #endif 7755 } 7756 7757 /* vec_vpkudus */ 7758 7759 #ifdef __POWER8_VECTOR__ 7760 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7761 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7762 #ifdef __LITTLE_ENDIAN__ 7763 return __builtin_altivec_vpkudus(__b, __a); 7764 #else 7765 return __builtin_altivec_vpkudus(__a, __b); 7766 #endif 7767 } 7768 #endif 7769 7770 /* vec_vpkswss */ 7771 7772 static __inline__ vector signed short __attribute__((__always_inline__)) 7773 vec_vpkswss(vector int __a, vector int __b) { 7774 #ifdef __LITTLE_ENDIAN__ 7775 return __builtin_altivec_vpkswss(__b, __a); 7776 #else 7777 return __builtin_altivec_vpkswss(__a, __b); 7778 #endif 7779 } 7780 7781 /* vec_vpkuwus */ 7782 7783 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7784 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7785 #ifdef __LITTLE_ENDIAN__ 7786 return __builtin_altivec_vpkuwus(__b, __a); 7787 #else 7788 return __builtin_altivec_vpkuwus(__a, __b); 7789 #endif 7790 } 7791 7792 /* vec_packsu */ 7793 7794 static __inline__ vector unsigned char __ATTRS_o_ai 7795 vec_packsu(vector short __a, vector short __b) { 7796 #ifdef __LITTLE_ENDIAN__ 7797 return __builtin_altivec_vpkshus(__b, __a); 7798 #else 7799 return __builtin_altivec_vpkshus(__a, __b); 7800 #endif 7801 } 7802 7803 static __inline__ vector unsigned char __ATTRS_o_ai 7804 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7805 #ifdef __LITTLE_ENDIAN__ 7806 return __builtin_altivec_vpkuhus(__b, __a); 7807 #else 7808 return __builtin_altivec_vpkuhus(__a, __b); 7809 #endif 7810 } 7811 7812 static __inline__ vector unsigned short __ATTRS_o_ai 7813 vec_packsu(vector int __a, vector int __b) { 7814 #ifdef __LITTLE_ENDIAN__ 7815 return __builtin_altivec_vpkswus(__b, __a); 7816 #else 7817 return __builtin_altivec_vpkswus(__a, __b); 7818 #endif 7819 } 7820 7821 static __inline__ vector unsigned short __ATTRS_o_ai 7822 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7823 #ifdef __LITTLE_ENDIAN__ 7824 return __builtin_altivec_vpkuwus(__b, __a); 7825 #else 7826 return __builtin_altivec_vpkuwus(__a, __b); 7827 #endif 7828 } 7829 7830 #ifdef __POWER8_VECTOR__ 7831 static __inline__ vector unsigned int __ATTRS_o_ai 7832 vec_packsu(vector long long __a, vector long long __b) { 7833 #ifdef __LITTLE_ENDIAN__ 7834 return __builtin_altivec_vpksdus(__b, __a); 7835 #else 7836 return __builtin_altivec_vpksdus(__a, __b); 7837 #endif 7838 } 7839 7840 static __inline__ vector unsigned int __ATTRS_o_ai 7841 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7842 #ifdef __LITTLE_ENDIAN__ 7843 return __builtin_altivec_vpkudus(__b, __a); 7844 #else 7845 return __builtin_altivec_vpkudus(__a, __b); 7846 #endif 7847 } 7848 #endif 7849 7850 /* vec_vpkshus */ 7851 7852 static __inline__ vector unsigned char __ATTRS_o_ai 7853 vec_vpkshus(vector short __a, vector short __b) { 7854 #ifdef __LITTLE_ENDIAN__ 7855 return __builtin_altivec_vpkshus(__b, __a); 7856 #else 7857 return __builtin_altivec_vpkshus(__a, __b); 7858 #endif 7859 } 7860 7861 static __inline__ vector unsigned char __ATTRS_o_ai 7862 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7863 #ifdef __LITTLE_ENDIAN__ 7864 return __builtin_altivec_vpkuhus(__b, __a); 7865 #else 7866 return __builtin_altivec_vpkuhus(__a, __b); 7867 #endif 7868 } 7869 7870 /* vec_vpkswus */ 7871 7872 static __inline__ vector unsigned short __ATTRS_o_ai 7873 vec_vpkswus(vector int __a, vector int __b) { 7874 #ifdef __LITTLE_ENDIAN__ 7875 return __builtin_altivec_vpkswus(__b, __a); 7876 #else 7877 return __builtin_altivec_vpkswus(__a, __b); 7878 #endif 7879 } 7880 7881 static __inline__ vector unsigned short __ATTRS_o_ai 7882 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7883 #ifdef __LITTLE_ENDIAN__ 7884 return __builtin_altivec_vpkuwus(__b, __a); 7885 #else 7886 return __builtin_altivec_vpkuwus(__a, __b); 7887 #endif 7888 } 7889 7890 /* vec_vpksdus */ 7891 7892 #ifdef __POWER8_VECTOR__ 7893 static __inline__ vector unsigned int __ATTRS_o_ai 7894 vec_vpksdus(vector long long __a, vector long long __b) { 7895 #ifdef __LITTLE_ENDIAN__ 7896 return __builtin_altivec_vpksdus(__b, __a); 7897 #else 7898 return __builtin_altivec_vpksdus(__a, __b); 7899 #endif 7900 } 7901 #endif 7902 7903 /* vec_perm */ 7904 7905 // The vperm instruction is defined architecturally with a big-endian bias. 7906 // For little endian, we swap the input operands and invert the permute 7907 // control vector. Only the rightmost 5 bits matter, so we could use 7908 // a vector of all 31s instead of all 255s to perform the inversion. 7909 // However, when the PCV is not a constant, using 255 has an advantage 7910 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7911 // later, possibly a vec_nand). 7912 7913 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7914 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7915 #ifdef __LITTLE_ENDIAN__ 7916 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7917 255, 255, 255, 255, 255, 255, 255, 255}; 7918 __d = vec_xor(__c, __d); 7919 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7920 (vector int)__a, __d); 7921 #else 7922 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7923 (vector int)__b, __c); 7924 #endif 7925 } 7926 7927 static __inline__ vector unsigned char __ATTRS_o_ai 7928 vec_perm(vector unsigned char __a, vector unsigned char __b, 7929 vector unsigned char __c) { 7930 #ifdef __LITTLE_ENDIAN__ 7931 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7932 255, 255, 255, 255, 255, 255, 255, 255}; 7933 __d = vec_xor(__c, __d); 7934 return (vector unsigned char)__builtin_altivec_vperm_4si( 7935 (vector int)__b, (vector int)__a, __d); 7936 #else 7937 return (vector unsigned char)__builtin_altivec_vperm_4si( 7938 (vector int)__a, (vector int)__b, __c); 7939 #endif 7940 } 7941 7942 static __inline__ vector bool char __ATTRS_o_ai 7943 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7944 #ifdef __LITTLE_ENDIAN__ 7945 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7946 255, 255, 255, 255, 255, 255, 255, 255}; 7947 __d = vec_xor(__c, __d); 7948 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 7949 (vector int)__a, __d); 7950 #else 7951 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7952 (vector int)__b, __c); 7953 #endif 7954 } 7955 7956 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7957 vector signed short __b, 7958 vector unsigned char __c) { 7959 #ifdef __LITTLE_ENDIAN__ 7960 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7961 255, 255, 255, 255, 255, 255, 255, 255}; 7962 __d = vec_xor(__c, __d); 7963 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 7964 (vector int)__a, __d); 7965 #else 7966 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 7967 (vector int)__b, __c); 7968 #endif 7969 } 7970 7971 static __inline__ vector unsigned short __ATTRS_o_ai 7972 vec_perm(vector unsigned short __a, vector unsigned short __b, 7973 vector unsigned char __c) { 7974 #ifdef __LITTLE_ENDIAN__ 7975 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7976 255, 255, 255, 255, 255, 255, 255, 255}; 7977 __d = vec_xor(__c, __d); 7978 return (vector unsigned short)__builtin_altivec_vperm_4si( 7979 (vector int)__b, (vector int)__a, __d); 7980 #else 7981 return (vector unsigned short)__builtin_altivec_vperm_4si( 7982 (vector int)__a, (vector int)__b, __c); 7983 #endif 7984 } 7985 7986 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 7987 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7988 #ifdef __LITTLE_ENDIAN__ 7989 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7990 255, 255, 255, 255, 255, 255, 255, 255}; 7991 __d = vec_xor(__c, __d); 7992 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 7993 (vector int)__a, __d); 7994 #else 7995 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 7996 (vector int)__b, __c); 7997 #endif 7998 } 7999 8000 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 8001 vector pixel __b, 8002 vector unsigned char __c) { 8003 #ifdef __LITTLE_ENDIAN__ 8004 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8005 255, 255, 255, 255, 255, 255, 255, 255}; 8006 __d = vec_xor(__c, __d); 8007 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 8008 (vector int)__a, __d); 8009 #else 8010 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 8011 (vector int)__b, __c); 8012 #endif 8013 } 8014 8015 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 8016 vector signed int __b, 8017 vector unsigned char __c) { 8018 #ifdef __LITTLE_ENDIAN__ 8019 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8020 255, 255, 255, 255, 255, 255, 255, 255}; 8021 __d = vec_xor(__c, __d); 8022 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 8023 #else 8024 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 8025 #endif 8026 } 8027 8028 static __inline__ vector unsigned int __ATTRS_o_ai 8029 vec_perm(vector unsigned int __a, vector unsigned int __b, 8030 vector unsigned char __c) { 8031 #ifdef __LITTLE_ENDIAN__ 8032 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8033 255, 255, 255, 255, 255, 255, 255, 255}; 8034 __d = vec_xor(__c, __d); 8035 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 8036 (vector int)__a, __d); 8037 #else 8038 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 8039 (vector int)__b, __c); 8040 #endif 8041 } 8042 8043 static __inline__ vector bool int __ATTRS_o_ai 8044 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8045 #ifdef __LITTLE_ENDIAN__ 8046 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8047 255, 255, 255, 255, 255, 255, 255, 255}; 8048 __d = vec_xor(__c, __d); 8049 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 8050 (vector int)__a, __d); 8051 #else 8052 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 8053 (vector int)__b, __c); 8054 #endif 8055 } 8056 8057 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 8058 vector float __b, 8059 vector unsigned char __c) { 8060 #ifdef __LITTLE_ENDIAN__ 8061 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8062 255, 255, 255, 255, 255, 255, 255, 255}; 8063 __d = vec_xor(__c, __d); 8064 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 8065 (vector int)__a, __d); 8066 #else 8067 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 8068 (vector int)__b, __c); 8069 #endif 8070 } 8071 8072 #ifdef __VSX__ 8073 static __inline__ vector long long __ATTRS_o_ai 8074 vec_perm(vector signed long long __a, vector signed long long __b, 8075 vector unsigned char __c) { 8076 #ifdef __LITTLE_ENDIAN__ 8077 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8078 255, 255, 255, 255, 255, 255, 255, 255}; 8079 __d = vec_xor(__c, __d); 8080 return (vector signed long long)__builtin_altivec_vperm_4si( 8081 (vector int)__b, (vector int)__a, __d); 8082 #else 8083 return (vector signed long long)__builtin_altivec_vperm_4si( 8084 (vector int)__a, (vector int)__b, __c); 8085 #endif 8086 } 8087 8088 static __inline__ vector unsigned long long __ATTRS_o_ai 8089 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 8090 vector unsigned char __c) { 8091 #ifdef __LITTLE_ENDIAN__ 8092 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8093 255, 255, 255, 255, 255, 255, 255, 255}; 8094 __d = vec_xor(__c, __d); 8095 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8096 (vector int)__b, (vector int)__a, __d); 8097 #else 8098 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8099 (vector int)__a, (vector int)__b, __c); 8100 #endif 8101 } 8102 8103 static __inline__ vector bool long long __ATTRS_o_ai 8104 vec_perm(vector bool long long __a, vector bool long long __b, 8105 vector unsigned char __c) { 8106 #ifdef __LITTLE_ENDIAN__ 8107 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8108 255, 255, 255, 255, 255, 255, 255, 255}; 8109 __d = vec_xor(__c, __d); 8110 return (vector bool long long)__builtin_altivec_vperm_4si( 8111 (vector int)__b, (vector int)__a, __d); 8112 #else 8113 return (vector bool long long)__builtin_altivec_vperm_4si( 8114 (vector int)__a, (vector int)__b, __c); 8115 #endif 8116 } 8117 8118 static __inline__ vector double __ATTRS_o_ai 8119 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 8120 #ifdef __LITTLE_ENDIAN__ 8121 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8122 255, 255, 255, 255, 255, 255, 255, 255}; 8123 __d = vec_xor(__c, __d); 8124 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 8125 (vector int)__a, __d); 8126 #else 8127 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 8128 (vector int)__b, __c); 8129 #endif 8130 } 8131 #endif 8132 8133 /* vec_vperm */ 8134 8135 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 8136 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8137 return vec_perm(__a, __b, __c); 8138 } 8139 8140 static __inline__ vector unsigned char __ATTRS_o_ai 8141 vec_vperm(vector unsigned char __a, vector unsigned char __b, 8142 vector unsigned char __c) { 8143 return vec_perm(__a, __b, __c); 8144 } 8145 8146 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 8147 vector bool char __a, vector bool char __b, vector unsigned char __c) { 8148 return vec_perm(__a, __b, __c); 8149 } 8150 8151 static __inline__ vector short __ATTRS_o_ai 8152 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 8153 return vec_perm(__a, __b, __c); 8154 } 8155 8156 static __inline__ vector unsigned short __ATTRS_o_ai 8157 vec_vperm(vector unsigned short __a, vector unsigned short __b, 8158 vector unsigned char __c) { 8159 return vec_perm(__a, __b, __c); 8160 } 8161 8162 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 8163 vector bool short __a, vector bool short __b, vector unsigned char __c) { 8164 return vec_perm(__a, __b, __c); 8165 } 8166 8167 static __inline__ vector pixel __ATTRS_o_ai 8168 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 8169 return vec_perm(__a, __b, __c); 8170 } 8171 8172 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 8173 vector int __b, 8174 vector unsigned char __c) { 8175 return vec_perm(__a, __b, __c); 8176 } 8177 8178 static __inline__ vector unsigned int __ATTRS_o_ai 8179 vec_vperm(vector unsigned int __a, vector unsigned int __b, 8180 vector unsigned char __c) { 8181 return vec_perm(__a, __b, __c); 8182 } 8183 8184 static __inline__ vector bool int __ATTRS_o_ai 8185 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8186 return vec_perm(__a, __b, __c); 8187 } 8188 8189 static __inline__ vector float __ATTRS_o_ai 8190 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 8191 return vec_perm(__a, __b, __c); 8192 } 8193 8194 #ifdef __VSX__ 8195 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 8196 vector long long __a, vector long long __b, vector unsigned char __c) { 8197 return vec_perm(__a, __b, __c); 8198 } 8199 8200 static __inline__ vector unsigned long long __ATTRS_o_ai 8201 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 8202 vector unsigned char __c) { 8203 return vec_perm(__a, __b, __c); 8204 } 8205 8206 static __inline__ vector double __ATTRS_o_ai 8207 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 8208 return vec_perm(__a, __b, __c); 8209 } 8210 #endif 8211 8212 /* vec_re */ 8213 8214 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 8215 #ifdef __VSX__ 8216 return __builtin_vsx_xvresp(__a); 8217 #else 8218 return __builtin_altivec_vrefp(__a); 8219 #endif 8220 } 8221 8222 #ifdef __VSX__ 8223 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 8224 return __builtin_vsx_xvredp(__a); 8225 } 8226 #endif 8227 8228 /* vec_vrefp */ 8229 8230 static __inline__ vector float __attribute__((__always_inline__)) 8231 vec_vrefp(vector float __a) { 8232 return __builtin_altivec_vrefp(__a); 8233 } 8234 8235 /* vec_rl */ 8236 8237 static __inline__ vector signed char __ATTRS_o_ai 8238 vec_rl(vector signed char __a, vector unsigned char __b) { 8239 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8240 } 8241 8242 static __inline__ vector unsigned char __ATTRS_o_ai 8243 vec_rl(vector unsigned char __a, vector unsigned char __b) { 8244 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8245 } 8246 8247 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 8248 vector unsigned short __b) { 8249 return __builtin_altivec_vrlh(__a, __b); 8250 } 8251 8252 static __inline__ vector unsigned short __ATTRS_o_ai 8253 vec_rl(vector unsigned short __a, vector unsigned short __b) { 8254 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8255 } 8256 8257 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 8258 vector unsigned int __b) { 8259 return __builtin_altivec_vrlw(__a, __b); 8260 } 8261 8262 static __inline__ vector unsigned int __ATTRS_o_ai 8263 vec_rl(vector unsigned int __a, vector unsigned int __b) { 8264 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8265 } 8266 8267 #ifdef __POWER8_VECTOR__ 8268 static __inline__ vector signed long long __ATTRS_o_ai 8269 vec_rl(vector signed long long __a, vector unsigned long long __b) { 8270 return __builtin_altivec_vrld(__a, __b); 8271 } 8272 8273 static __inline__ vector unsigned long long __ATTRS_o_ai 8274 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 8275 return __builtin_altivec_vrld(__a, __b); 8276 } 8277 #endif 8278 8279 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8280 static __inline__ vector signed __int128 __ATTRS_o_ai 8281 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { 8282 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a)); 8283 } 8284 8285 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8286 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 8287 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); 8288 } 8289 #endif 8290 8291 /* vec_rlmi */ 8292 #ifdef __POWER9_VECTOR__ 8293 static __inline__ vector unsigned int __ATTRS_o_ai 8294 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 8295 vector unsigned int __c) { 8296 return __builtin_altivec_vrlwmi(__a, __c, __b); 8297 } 8298 8299 static __inline__ vector unsigned long long __ATTRS_o_ai 8300 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 8301 vector unsigned long long __c) { 8302 return __builtin_altivec_vrldmi(__a, __c, __b); 8303 } 8304 #endif 8305 8306 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8307 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8308 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, 8309 vector unsigned __int128 __c) { 8310 return __builtin_altivec_vrlqmi(__a, __c, __b); 8311 } 8312 8313 static __inline__ vector signed __int128 __ATTRS_o_ai 8314 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, 8315 vector signed __int128 __c) { 8316 return __builtin_altivec_vrlqmi(__a, __c, __b); 8317 } 8318 #endif 8319 8320 /* vec_rlnm */ 8321 #ifdef __POWER9_VECTOR__ 8322 static __inline__ vector unsigned int __ATTRS_o_ai 8323 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 8324 vector unsigned int __c) { 8325 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 8326 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 8327 } 8328 8329 static __inline__ vector unsigned long long __ATTRS_o_ai 8330 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 8331 vector unsigned long long __c) { 8332 vector unsigned long long OneByte = { 0x8, 0x8 }; 8333 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 8334 } 8335 #endif 8336 8337 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8338 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8339 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, 8340 vector unsigned __int128 __c) { 8341 // Merge __b and __c using an appropriate shuffle. 8342 vector unsigned char TmpB = (vector unsigned char)__b; 8343 vector unsigned char TmpC = (vector unsigned char)__c; 8344 vector unsigned char MaskAndShift = 8345 #ifdef __LITTLE_ENDIAN__ 8346 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8347 1, -1, -1, -1, -1, -1); 8348 #else 8349 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8350 -1, -1, -1, -1, -1, -1, -1); 8351 #endif 8352 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8353 } 8354 8355 static __inline__ vector signed __int128 __ATTRS_o_ai 8356 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, 8357 vector signed __int128 __c) { 8358 // Merge __b and __c using an appropriate shuffle. 8359 vector unsigned char TmpB = (vector unsigned char)__b; 8360 vector unsigned char TmpC = (vector unsigned char)__c; 8361 vector unsigned char MaskAndShift = 8362 #ifdef __LITTLE_ENDIAN__ 8363 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8364 1, -1, -1, -1, -1, -1); 8365 #else 8366 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8367 -1, -1, -1, -1, -1, -1, -1); 8368 #endif 8369 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8370 } 8371 #endif 8372 8373 /* vec_vrlb */ 8374 8375 static __inline__ vector signed char __ATTRS_o_ai 8376 vec_vrlb(vector signed char __a, vector unsigned char __b) { 8377 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8378 } 8379 8380 static __inline__ vector unsigned char __ATTRS_o_ai 8381 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 8382 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8383 } 8384 8385 /* vec_vrlh */ 8386 8387 static __inline__ vector short __ATTRS_o_ai 8388 vec_vrlh(vector short __a, vector unsigned short __b) { 8389 return __builtin_altivec_vrlh(__a, __b); 8390 } 8391 8392 static __inline__ vector unsigned short __ATTRS_o_ai 8393 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 8394 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8395 } 8396 8397 /* vec_vrlw */ 8398 8399 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 8400 vector unsigned int __b) { 8401 return __builtin_altivec_vrlw(__a, __b); 8402 } 8403 8404 static __inline__ vector unsigned int __ATTRS_o_ai 8405 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 8406 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8407 } 8408 8409 /* vec_round */ 8410 8411 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 8412 return __builtin_altivec_vrfin(__a); 8413 } 8414 8415 #ifdef __VSX__ 8416 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8417 return __builtin_vsx_xvrdpi(__a); 8418 } 8419 8420 /* vec_rint */ 8421 8422 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 8423 return __builtin_vsx_xvrspic(__a); 8424 } 8425 8426 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 8427 return __builtin_vsx_xvrdpic(__a); 8428 } 8429 8430 /* vec_roundc */ 8431 8432 static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { 8433 return __builtin_vsx_xvrspic(__a); 8434 } 8435 8436 static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { 8437 return __builtin_vsx_xvrdpic(__a); 8438 } 8439 8440 /* vec_nearbyint */ 8441 8442 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 8443 return __builtin_vsx_xvrspi(__a); 8444 } 8445 8446 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 8447 return __builtin_vsx_xvrdpi(__a); 8448 } 8449 #endif 8450 8451 /* vec_vrfin */ 8452 8453 static __inline__ vector float __attribute__((__always_inline__)) 8454 vec_vrfin(vector float __a) { 8455 return __builtin_altivec_vrfin(__a); 8456 } 8457 8458 /* vec_sqrt */ 8459 8460 #ifdef __VSX__ 8461 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 8462 return __builtin_vsx_xvsqrtsp(__a); 8463 } 8464 8465 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 8466 return __builtin_vsx_xvsqrtdp(__a); 8467 } 8468 #endif 8469 8470 /* vec_rsqrte */ 8471 8472 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 8473 #ifdef __VSX__ 8474 return __builtin_vsx_xvrsqrtesp(__a); 8475 #else 8476 return __builtin_altivec_vrsqrtefp(__a); 8477 #endif 8478 } 8479 8480 #ifdef __VSX__ 8481 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 8482 return __builtin_vsx_xvrsqrtedp(__a); 8483 } 8484 #endif 8485 8486 static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { 8487 return __builtin_ppc_rsqrtf(__a); 8488 } 8489 8490 #ifdef __VSX__ 8491 static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { 8492 return __builtin_ppc_rsqrtd(__a); 8493 } 8494 #endif 8495 8496 /* vec_vrsqrtefp */ 8497 8498 static __inline__ __vector float __attribute__((__always_inline__)) 8499 vec_vrsqrtefp(vector float __a) { 8500 return __builtin_altivec_vrsqrtefp(__a); 8501 } 8502 8503 /* vec_xvtsqrt */ 8504 8505 #ifdef __VSX__ 8506 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { 8507 return __builtin_vsx_xvtsqrtdp(__a); 8508 } 8509 8510 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { 8511 return __builtin_vsx_xvtsqrtsp(__a); 8512 } 8513 #endif 8514 8515 /* vec_sel */ 8516 8517 #define __builtin_altivec_vsel_4si vec_sel 8518 8519 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 8520 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8521 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8522 } 8523 8524 static __inline__ vector signed char __ATTRS_o_ai 8525 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 8526 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8527 } 8528 8529 static __inline__ vector unsigned char __ATTRS_o_ai 8530 vec_sel(vector unsigned char __a, vector unsigned char __b, 8531 vector unsigned char __c) { 8532 return (__a & ~__c) | (__b & __c); 8533 } 8534 8535 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 8536 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8537 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8538 } 8539 8540 static __inline__ vector bool char __ATTRS_o_ai 8541 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8542 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8543 } 8544 8545 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 8546 vector bool char __b, 8547 vector bool char __c) { 8548 return (__a & ~__c) | (__b & __c); 8549 } 8550 8551 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8552 vector short __b, 8553 vector unsigned short __c) { 8554 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8555 } 8556 8557 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8558 vector short __b, 8559 vector bool short __c) { 8560 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8561 } 8562 8563 static __inline__ vector unsigned short __ATTRS_o_ai 8564 vec_sel(vector unsigned short __a, vector unsigned short __b, 8565 vector unsigned short __c) { 8566 return (__a & ~__c) | (__b & __c); 8567 } 8568 8569 static __inline__ vector unsigned short __ATTRS_o_ai 8570 vec_sel(vector unsigned short __a, vector unsigned short __b, 8571 vector bool short __c) { 8572 return (__a & ~(vector unsigned short)__c) | 8573 (__b & (vector unsigned short)__c); 8574 } 8575 8576 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 8577 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8578 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8579 } 8580 8581 static __inline__ vector bool short __ATTRS_o_ai 8582 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 8583 return (__a & ~__c) | (__b & __c); 8584 } 8585 8586 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8587 vector int __b, 8588 vector unsigned int __c) { 8589 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8590 } 8591 8592 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8593 vector int __b, 8594 vector bool int __c) { 8595 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8596 } 8597 8598 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 8599 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8600 return (__a & ~__c) | (__b & __c); 8601 } 8602 8603 static __inline__ vector unsigned int __ATTRS_o_ai 8604 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8605 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8606 } 8607 8608 static __inline__ vector bool int __ATTRS_o_ai 8609 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8610 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8611 } 8612 8613 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 8614 vector bool int __b, 8615 vector bool int __c) { 8616 return (__a & ~__c) | (__b & __c); 8617 } 8618 8619 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8620 vector float __b, 8621 vector unsigned int __c) { 8622 vector int __res = ((vector int)__a & ~(vector int)__c) | 8623 ((vector int)__b & (vector int)__c); 8624 return (vector float)__res; 8625 } 8626 8627 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8628 vector float __b, 8629 vector bool int __c) { 8630 vector int __res = ((vector int)__a & ~(vector int)__c) | 8631 ((vector int)__b & (vector int)__c); 8632 return (vector float)__res; 8633 } 8634 8635 #ifdef __VSX__ 8636 static __inline__ vector double __ATTRS_o_ai 8637 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 8638 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8639 ((vector long long)__b & (vector long long)__c); 8640 return (vector double)__res; 8641 } 8642 8643 static __inline__ vector double __ATTRS_o_ai 8644 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 8645 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8646 ((vector long long)__b & (vector long long)__c); 8647 return (vector double)__res; 8648 } 8649 8650 static __inline__ vector bool long long __ATTRS_o_ai 8651 vec_sel(vector bool long long __a, vector bool long long __b, 8652 vector bool long long __c) { 8653 return (__a & ~__c) | (__b & __c); 8654 } 8655 8656 static __inline__ vector bool long long __ATTRS_o_ai 8657 vec_sel(vector bool long long __a, vector bool long long __b, 8658 vector unsigned long long __c) { 8659 return (__a & ~(vector bool long long)__c) | 8660 (__b & (vector bool long long)__c); 8661 } 8662 8663 static __inline__ vector signed long long __ATTRS_o_ai 8664 vec_sel(vector signed long long __a, vector signed long long __b, 8665 vector bool long long __c) { 8666 return (__a & ~(vector signed long long)__c) | 8667 (__b & (vector signed long long)__c); 8668 } 8669 8670 static __inline__ vector signed long long __ATTRS_o_ai 8671 vec_sel(vector signed long long __a, vector signed long long __b, 8672 vector unsigned long long __c) { 8673 return (__a & ~(vector signed long long)__c) | 8674 (__b & (vector signed long long)__c); 8675 } 8676 8677 static __inline__ vector unsigned long long __ATTRS_o_ai 8678 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8679 vector bool long long __c) { 8680 return (__a & ~(vector unsigned long long)__c) | 8681 (__b & (vector unsigned long long)__c); 8682 } 8683 8684 static __inline__ vector unsigned long long __ATTRS_o_ai 8685 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8686 vector unsigned long long __c) { 8687 return (__a & ~__c) | (__b & __c); 8688 } 8689 #endif 8690 8691 /* vec_vsel */ 8692 8693 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 8694 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8695 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8696 } 8697 8698 static __inline__ vector signed char __ATTRS_o_ai 8699 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 8700 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8701 } 8702 8703 static __inline__ vector unsigned char __ATTRS_o_ai 8704 vec_vsel(vector unsigned char __a, vector unsigned char __b, 8705 vector unsigned char __c) { 8706 return (__a & ~__c) | (__b & __c); 8707 } 8708 8709 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 8710 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8711 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8712 } 8713 8714 static __inline__ vector bool char __ATTRS_o_ai 8715 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8716 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8717 } 8718 8719 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 8720 vector bool char __b, 8721 vector bool char __c) { 8722 return (__a & ~__c) | (__b & __c); 8723 } 8724 8725 static __inline__ vector short __ATTRS_o_ai 8726 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8727 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8728 } 8729 8730 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8731 vector short __b, 8732 vector bool short __c) { 8733 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8734 } 8735 8736 static __inline__ vector unsigned short __ATTRS_o_ai 8737 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8738 vector unsigned short __c) { 8739 return (__a & ~__c) | (__b & __c); 8740 } 8741 8742 static __inline__ vector unsigned short __ATTRS_o_ai 8743 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8744 vector bool short __c) { 8745 return (__a & ~(vector unsigned short)__c) | 8746 (__b & (vector unsigned short)__c); 8747 } 8748 8749 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8750 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8751 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8752 } 8753 8754 static __inline__ vector bool short __ATTRS_o_ai 8755 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8756 return (__a & ~__c) | (__b & __c); 8757 } 8758 8759 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8760 vector int __b, 8761 vector unsigned int __c) { 8762 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8763 } 8764 8765 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8766 vector int __b, 8767 vector bool int __c) { 8768 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8769 } 8770 8771 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8772 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8773 return (__a & ~__c) | (__b & __c); 8774 } 8775 8776 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8777 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8778 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8779 } 8780 8781 static __inline__ vector bool int __ATTRS_o_ai 8782 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8783 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8784 } 8785 8786 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8787 vector bool int __b, 8788 vector bool int __c) { 8789 return (__a & ~__c) | (__b & __c); 8790 } 8791 8792 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8793 vector float __b, 8794 vector unsigned int __c) { 8795 vector int __res = ((vector int)__a & ~(vector int)__c) | 8796 ((vector int)__b & (vector int)__c); 8797 return (vector float)__res; 8798 } 8799 8800 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8801 vector float __b, 8802 vector bool int __c) { 8803 vector int __res = ((vector int)__a & ~(vector int)__c) | 8804 ((vector int)__b & (vector int)__c); 8805 return (vector float)__res; 8806 } 8807 8808 /* vec_sl */ 8809 8810 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8811 // than the length of __a. 8812 static __inline__ vector unsigned char __ATTRS_o_ai 8813 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8814 return __a << (__b % 8815 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8816 } 8817 8818 static __inline__ vector signed char __ATTRS_o_ai 8819 vec_sl(vector signed char __a, vector unsigned char __b) { 8820 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8821 } 8822 8823 static __inline__ vector unsigned short __ATTRS_o_ai 8824 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8825 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8826 __CHAR_BIT__)); 8827 } 8828 8829 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8830 vector unsigned short __b) { 8831 return (vector short)vec_sl((vector unsigned short)__a, __b); 8832 } 8833 8834 static __inline__ vector unsigned int __ATTRS_o_ai 8835 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8836 return __a << (__b % 8837 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8838 } 8839 8840 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8841 vector unsigned int __b) { 8842 return (vector int)vec_sl((vector unsigned int)__a, __b); 8843 } 8844 8845 #ifdef __POWER8_VECTOR__ 8846 static __inline__ vector unsigned long long __ATTRS_o_ai 8847 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8848 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8849 __CHAR_BIT__)); 8850 } 8851 8852 static __inline__ vector long long __ATTRS_o_ai 8853 vec_sl(vector long long __a, vector unsigned long long __b) { 8854 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8855 } 8856 #elif defined(__VSX__) 8857 static __inline__ vector unsigned char __ATTRS_o_ai 8858 vec_vspltb(vector unsigned char __a, unsigned char __b); 8859 static __inline__ vector unsigned long long __ATTRS_o_ai 8860 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8861 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 8862 8863 // Big endian element one (the right doubleword) can be left shifted as-is. 8864 // The other element needs to be swapped into the right doubleword and 8865 // shifted. Then the right doublewords of the two result vectors are merged. 8866 vector signed long long __rightelt = 8867 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8868 (vector signed int)__b); 8869 #ifdef __LITTLE_ENDIAN__ 8870 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8871 (vector signed int)__rightelt, 8872 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8873 #else 8874 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8875 (vector signed int)__rightelt, 8876 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8877 #endif 8878 __a = __builtin_shufflevector(__a, __a, 1, 0); 8879 __b = __builtin_shufflevector(__b, __b, 1, 0); 8880 vector signed long long __leftelt = 8881 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8882 (vector signed int)__b); 8883 #ifdef __LITTLE_ENDIAN__ 8884 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8885 (vector signed int)__leftelt, 8886 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8887 return (vector unsigned long long)__builtin_shufflevector(__rightelt, 8888 __leftelt, 0, 2); 8889 #else 8890 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8891 (vector signed int)__leftelt, 8892 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8893 return (vector unsigned long long)__builtin_shufflevector(__leftelt, 8894 __rightelt, 1, 3); 8895 #endif 8896 } 8897 8898 static __inline__ vector long long __ATTRS_o_ai 8899 vec_sl(vector long long __a, vector unsigned long long __b) { 8900 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8901 } 8902 #endif /* __VSX__ */ 8903 8904 /* vec_vslb */ 8905 8906 #define __builtin_altivec_vslb vec_vslb 8907 8908 static __inline__ vector signed char __ATTRS_o_ai 8909 vec_vslb(vector signed char __a, vector unsigned char __b) { 8910 return vec_sl(__a, __b); 8911 } 8912 8913 static __inline__ vector unsigned char __ATTRS_o_ai 8914 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8915 return vec_sl(__a, __b); 8916 } 8917 8918 /* vec_vslh */ 8919 8920 #define __builtin_altivec_vslh vec_vslh 8921 8922 static __inline__ vector short __ATTRS_o_ai 8923 vec_vslh(vector short __a, vector unsigned short __b) { 8924 return vec_sl(__a, __b); 8925 } 8926 8927 static __inline__ vector unsigned short __ATTRS_o_ai 8928 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8929 return vec_sl(__a, __b); 8930 } 8931 8932 /* vec_vslw */ 8933 8934 #define __builtin_altivec_vslw vec_vslw 8935 8936 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8937 vector unsigned int __b) { 8938 return vec_sl(__a, __b); 8939 } 8940 8941 static __inline__ vector unsigned int __ATTRS_o_ai 8942 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 8943 return vec_sl(__a, __b); 8944 } 8945 8946 /* vec_sld */ 8947 8948 #define __builtin_altivec_vsldoi_4si vec_sld 8949 8950 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 8951 vector signed char __a, vector signed char __b, unsigned const int __c) { 8952 unsigned char __d = __c & 0x0F; 8953 #ifdef __LITTLE_ENDIAN__ 8954 return vec_perm( 8955 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8956 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8957 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8958 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8959 #else 8960 return vec_perm( 8961 __a, __b, 8962 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8963 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8964 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8965 #endif 8966 } 8967 8968 static __inline__ vector unsigned char __ATTRS_o_ai 8969 vec_sld(vector unsigned char __a, vector unsigned char __b, 8970 unsigned const int __c) { 8971 unsigned char __d = __c & 0x0F; 8972 #ifdef __LITTLE_ENDIAN__ 8973 return vec_perm( 8974 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8975 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8976 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8977 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8978 #else 8979 return vec_perm( 8980 __a, __b, 8981 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8982 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8983 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8984 #endif 8985 } 8986 8987 static __inline__ vector bool char __ATTRS_o_ai 8988 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 8989 unsigned char __d = __c & 0x0F; 8990 #ifdef __LITTLE_ENDIAN__ 8991 return vec_perm( 8992 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8993 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8994 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8995 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8996 #else 8997 return vec_perm( 8998 __a, __b, 8999 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9000 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9001 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9002 #endif 9003 } 9004 9005 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 9006 vector signed short __a, vector signed short __b, unsigned const int __c) { 9007 unsigned char __d = __c & 0x0F; 9008 #ifdef __LITTLE_ENDIAN__ 9009 return vec_perm( 9010 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9011 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9012 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9013 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9014 #else 9015 return vec_perm( 9016 __a, __b, 9017 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9018 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9019 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9020 #endif 9021 } 9022 9023 static __inline__ vector unsigned short __ATTRS_o_ai 9024 vec_sld(vector unsigned short __a, vector unsigned short __b, 9025 unsigned const int __c) { 9026 unsigned char __d = __c & 0x0F; 9027 #ifdef __LITTLE_ENDIAN__ 9028 return vec_perm( 9029 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9030 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9031 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9032 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9033 #else 9034 return vec_perm( 9035 __a, __b, 9036 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9037 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9038 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9039 #endif 9040 } 9041 9042 static __inline__ vector bool short __ATTRS_o_ai 9043 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 9044 unsigned char __d = __c & 0x0F; 9045 #ifdef __LITTLE_ENDIAN__ 9046 return vec_perm( 9047 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9048 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9049 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9050 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9051 #else 9052 return vec_perm( 9053 __a, __b, 9054 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9055 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9056 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9057 #endif 9058 } 9059 9060 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 9061 vector pixel __b, 9062 unsigned const int __c) { 9063 unsigned char __d = __c & 0x0F; 9064 #ifdef __LITTLE_ENDIAN__ 9065 return vec_perm( 9066 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9067 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9068 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9069 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9070 #else 9071 return vec_perm( 9072 __a, __b, 9073 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9074 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9075 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9076 #endif 9077 } 9078 9079 static __inline__ vector signed int __ATTRS_o_ai 9080 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 9081 unsigned char __d = __c & 0x0F; 9082 #ifdef __LITTLE_ENDIAN__ 9083 return vec_perm( 9084 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9085 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9086 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9087 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9088 #else 9089 return vec_perm( 9090 __a, __b, 9091 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9092 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9093 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9094 #endif 9095 } 9096 9097 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 9098 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9099 unsigned char __d = __c & 0x0F; 9100 #ifdef __LITTLE_ENDIAN__ 9101 return vec_perm( 9102 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9103 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9104 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9105 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9106 #else 9107 return vec_perm( 9108 __a, __b, 9109 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9110 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9111 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9112 #endif 9113 } 9114 9115 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 9116 vector bool int __b, 9117 unsigned const int __c) { 9118 unsigned char __d = __c & 0x0F; 9119 #ifdef __LITTLE_ENDIAN__ 9120 return vec_perm( 9121 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9122 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9123 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9124 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9125 #else 9126 return vec_perm( 9127 __a, __b, 9128 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9129 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9130 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9131 #endif 9132 } 9133 9134 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 9135 vector float __b, 9136 unsigned const int __c) { 9137 unsigned char __d = __c & 0x0F; 9138 #ifdef __LITTLE_ENDIAN__ 9139 return vec_perm( 9140 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9141 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9142 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9143 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9144 #else 9145 return vec_perm( 9146 __a, __b, 9147 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9148 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9149 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9150 #endif 9151 } 9152 9153 #ifdef __VSX__ 9154 static __inline__ vector bool long long __ATTRS_o_ai 9155 vec_sld(vector bool long long __a, vector bool long long __b, 9156 unsigned const int __c) { 9157 unsigned char __d = __c & 0x0F; 9158 #ifdef __LITTLE_ENDIAN__ 9159 return vec_perm( 9160 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9161 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9162 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9163 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9164 #else 9165 return vec_perm( 9166 __a, __b, 9167 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9168 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9169 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9170 #endif 9171 } 9172 9173 static __inline__ vector signed long long __ATTRS_o_ai 9174 vec_sld(vector signed long long __a, vector signed long long __b, 9175 unsigned const int __c) { 9176 unsigned char __d = __c & 0x0F; 9177 #ifdef __LITTLE_ENDIAN__ 9178 return vec_perm( 9179 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9180 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9181 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9182 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9183 #else 9184 return vec_perm( 9185 __a, __b, 9186 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9187 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9188 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9189 #endif 9190 } 9191 9192 static __inline__ vector unsigned long long __ATTRS_o_ai 9193 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 9194 unsigned const int __c) { 9195 unsigned char __d = __c & 0x0F; 9196 #ifdef __LITTLE_ENDIAN__ 9197 return vec_perm( 9198 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9199 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9200 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9201 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9202 #else 9203 return vec_perm( 9204 __a, __b, 9205 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9206 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9207 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9208 #endif 9209 } 9210 9211 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 9212 vector double __b, 9213 unsigned const int __c) { 9214 unsigned char __d = __c & 0x0F; 9215 #ifdef __LITTLE_ENDIAN__ 9216 return vec_perm( 9217 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9218 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9219 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9220 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9221 #else 9222 return vec_perm( 9223 __a, __b, 9224 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9225 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9226 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9227 #endif 9228 } 9229 #endif 9230 9231 /* vec_sldw */ 9232 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 9233 vector signed char __a, vector signed char __b, unsigned const int __c) { 9234 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9235 } 9236 9237 static __inline__ vector unsigned char __ATTRS_o_ai 9238 vec_sldw(vector unsigned char __a, vector unsigned char __b, 9239 unsigned const int __c) { 9240 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9241 } 9242 9243 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 9244 vector signed short __a, vector signed short __b, unsigned const int __c) { 9245 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9246 } 9247 9248 static __inline__ vector unsigned short __ATTRS_o_ai 9249 vec_sldw(vector unsigned short __a, vector unsigned short __b, 9250 unsigned const int __c) { 9251 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9252 } 9253 9254 static __inline__ vector signed int __ATTRS_o_ai 9255 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 9256 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9257 } 9258 9259 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 9260 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9261 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9262 } 9263 9264 static __inline__ vector float __ATTRS_o_ai vec_sldw( 9265 vector float __a, vector float __b, unsigned const int __c) { 9266 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9267 } 9268 9269 #ifdef __VSX__ 9270 static __inline__ vector signed long long __ATTRS_o_ai 9271 vec_sldw(vector signed long long __a, vector signed long long __b, 9272 unsigned const int __c) { 9273 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9274 } 9275 9276 static __inline__ vector unsigned long long __ATTRS_o_ai 9277 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 9278 unsigned const int __c) { 9279 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9280 } 9281 9282 static __inline__ vector double __ATTRS_o_ai vec_sldw( 9283 vector double __a, vector double __b, unsigned const int __c) { 9284 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9285 } 9286 #endif 9287 9288 #ifdef __POWER9_VECTOR__ 9289 /* vec_slv */ 9290 static __inline__ vector unsigned char __ATTRS_o_ai 9291 vec_slv(vector unsigned char __a, vector unsigned char __b) { 9292 return __builtin_altivec_vslv(__a, __b); 9293 } 9294 9295 /* vec_srv */ 9296 static __inline__ vector unsigned char __ATTRS_o_ai 9297 vec_srv(vector unsigned char __a, vector unsigned char __b) { 9298 return __builtin_altivec_vsrv(__a, __b); 9299 } 9300 #endif 9301 9302 /* vec_vsldoi */ 9303 9304 static __inline__ vector signed char __ATTRS_o_ai 9305 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 9306 unsigned char __d = __c & 0x0F; 9307 #ifdef __LITTLE_ENDIAN__ 9308 return vec_perm( 9309 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9310 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9311 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9312 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9313 #else 9314 return vec_perm( 9315 __a, __b, 9316 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9317 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9318 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9319 #endif 9320 } 9321 9322 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 9323 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 9324 unsigned char __d = __c & 0x0F; 9325 #ifdef __LITTLE_ENDIAN__ 9326 return vec_perm( 9327 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9328 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9329 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9330 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9331 #else 9332 return vec_perm( 9333 __a, __b, 9334 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9335 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9336 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9337 #endif 9338 } 9339 9340 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 9341 vector short __b, 9342 unsigned char __c) { 9343 unsigned char __d = __c & 0x0F; 9344 #ifdef __LITTLE_ENDIAN__ 9345 return vec_perm( 9346 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9347 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9348 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9349 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9350 #else 9351 return vec_perm( 9352 __a, __b, 9353 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9354 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9355 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9356 #endif 9357 } 9358 9359 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 9360 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 9361 unsigned char __d = __c & 0x0F; 9362 #ifdef __LITTLE_ENDIAN__ 9363 return vec_perm( 9364 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9365 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9366 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9367 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9368 #else 9369 return vec_perm( 9370 __a, __b, 9371 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9372 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9373 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9374 #endif 9375 } 9376 9377 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 9378 vector pixel __b, 9379 unsigned char __c) { 9380 unsigned char __d = __c & 0x0F; 9381 #ifdef __LITTLE_ENDIAN__ 9382 return vec_perm( 9383 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9384 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9385 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9386 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9387 #else 9388 return vec_perm( 9389 __a, __b, 9390 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9391 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9392 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9393 #endif 9394 } 9395 9396 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 9397 vector int __b, 9398 unsigned char __c) { 9399 unsigned char __d = __c & 0x0F; 9400 #ifdef __LITTLE_ENDIAN__ 9401 return vec_perm( 9402 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9403 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9404 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9405 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9406 #else 9407 return vec_perm( 9408 __a, __b, 9409 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9410 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9411 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9412 #endif 9413 } 9414 9415 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 9416 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 9417 unsigned char __d = __c & 0x0F; 9418 #ifdef __LITTLE_ENDIAN__ 9419 return vec_perm( 9420 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9421 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9422 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9423 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9424 #else 9425 return vec_perm( 9426 __a, __b, 9427 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9428 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9429 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9430 #endif 9431 } 9432 9433 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 9434 vector float __b, 9435 unsigned char __c) { 9436 unsigned char __d = __c & 0x0F; 9437 #ifdef __LITTLE_ENDIAN__ 9438 return vec_perm( 9439 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9440 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9441 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9442 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9443 #else 9444 return vec_perm( 9445 __a, __b, 9446 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9447 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9448 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9449 #endif 9450 } 9451 9452 /* vec_sll */ 9453 9454 static __inline__ vector signed char __ATTRS_o_ai 9455 vec_sll(vector signed char __a, vector unsigned char __b) { 9456 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9457 (vector int)__b); 9458 } 9459 9460 static __inline__ vector signed char __ATTRS_o_ai 9461 vec_sll(vector signed char __a, vector unsigned short __b) { 9462 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9463 (vector int)__b); 9464 } 9465 9466 static __inline__ vector signed char __ATTRS_o_ai 9467 vec_sll(vector signed char __a, vector unsigned int __b) { 9468 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9469 (vector int)__b); 9470 } 9471 9472 static __inline__ vector unsigned char __ATTRS_o_ai 9473 vec_sll(vector unsigned char __a, vector unsigned char __b) { 9474 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9475 (vector int)__b); 9476 } 9477 9478 static __inline__ vector unsigned char __ATTRS_o_ai 9479 vec_sll(vector unsigned char __a, vector unsigned short __b) { 9480 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9481 (vector int)__b); 9482 } 9483 9484 static __inline__ vector unsigned char __ATTRS_o_ai 9485 vec_sll(vector unsigned char __a, vector unsigned int __b) { 9486 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9487 (vector int)__b); 9488 } 9489 9490 static __inline__ vector bool char __ATTRS_o_ai 9491 vec_sll(vector bool char __a, vector unsigned char __b) { 9492 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9493 (vector int)__b); 9494 } 9495 9496 static __inline__ vector bool char __ATTRS_o_ai 9497 vec_sll(vector bool char __a, vector unsigned short __b) { 9498 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9499 (vector int)__b); 9500 } 9501 9502 static __inline__ vector bool char __ATTRS_o_ai 9503 vec_sll(vector bool char __a, vector unsigned int __b) { 9504 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9505 (vector int)__b); 9506 } 9507 9508 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9509 vector unsigned char __b) { 9510 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9511 } 9512 9513 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9514 vector unsigned short __b) { 9515 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9516 } 9517 9518 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9519 vector unsigned int __b) { 9520 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9521 } 9522 9523 static __inline__ vector unsigned short __ATTRS_o_ai 9524 vec_sll(vector unsigned short __a, vector unsigned char __b) { 9525 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9526 (vector int)__b); 9527 } 9528 9529 static __inline__ vector unsigned short __ATTRS_o_ai 9530 vec_sll(vector unsigned short __a, vector unsigned short __b) { 9531 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9532 (vector int)__b); 9533 } 9534 9535 static __inline__ vector unsigned short __ATTRS_o_ai 9536 vec_sll(vector unsigned short __a, vector unsigned int __b) { 9537 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9538 (vector int)__b); 9539 } 9540 9541 static __inline__ vector bool short __ATTRS_o_ai 9542 vec_sll(vector bool short __a, vector unsigned char __b) { 9543 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9544 (vector int)__b); 9545 } 9546 9547 static __inline__ vector bool short __ATTRS_o_ai 9548 vec_sll(vector bool short __a, vector unsigned short __b) { 9549 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9550 (vector int)__b); 9551 } 9552 9553 static __inline__ vector bool short __ATTRS_o_ai 9554 vec_sll(vector bool short __a, vector unsigned int __b) { 9555 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9556 (vector int)__b); 9557 } 9558 9559 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9560 vector unsigned char __b) { 9561 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9562 } 9563 9564 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9565 vector unsigned short __b) { 9566 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9567 } 9568 9569 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9570 vector unsigned int __b) { 9571 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9572 } 9573 9574 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9575 vector unsigned char __b) { 9576 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9577 } 9578 9579 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9580 vector unsigned short __b) { 9581 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9582 } 9583 9584 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9585 vector unsigned int __b) { 9586 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9587 } 9588 9589 static __inline__ vector unsigned int __ATTRS_o_ai 9590 vec_sll(vector unsigned int __a, vector unsigned char __b) { 9591 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9592 (vector int)__b); 9593 } 9594 9595 static __inline__ vector unsigned int __ATTRS_o_ai 9596 vec_sll(vector unsigned int __a, vector unsigned short __b) { 9597 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9598 (vector int)__b); 9599 } 9600 9601 static __inline__ vector unsigned int __ATTRS_o_ai 9602 vec_sll(vector unsigned int __a, vector unsigned int __b) { 9603 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9604 (vector int)__b); 9605 } 9606 9607 static __inline__ vector bool int __ATTRS_o_ai 9608 vec_sll(vector bool int __a, vector unsigned char __b) { 9609 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9610 (vector int)__b); 9611 } 9612 9613 static __inline__ vector bool int __ATTRS_o_ai 9614 vec_sll(vector bool int __a, vector unsigned short __b) { 9615 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9616 (vector int)__b); 9617 } 9618 9619 static __inline__ vector bool int __ATTRS_o_ai 9620 vec_sll(vector bool int __a, vector unsigned int __b) { 9621 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9622 (vector int)__b); 9623 } 9624 9625 #ifdef __VSX__ 9626 static __inline__ vector signed long long __ATTRS_o_ai 9627 vec_sll(vector signed long long __a, vector unsigned char __b) { 9628 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 9629 (vector int)__b); 9630 } 9631 9632 static __inline__ vector unsigned long long __ATTRS_o_ai 9633 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 9634 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 9635 (vector int)__b); 9636 } 9637 #endif 9638 9639 /* vec_vsl */ 9640 9641 static __inline__ vector signed char __ATTRS_o_ai 9642 vec_vsl(vector signed char __a, vector unsigned char __b) { 9643 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9644 (vector int)__b); 9645 } 9646 9647 static __inline__ vector signed char __ATTRS_o_ai 9648 vec_vsl(vector signed char __a, vector unsigned short __b) { 9649 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9650 (vector int)__b); 9651 } 9652 9653 static __inline__ vector signed char __ATTRS_o_ai 9654 vec_vsl(vector signed char __a, vector unsigned int __b) { 9655 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9656 (vector int)__b); 9657 } 9658 9659 static __inline__ vector unsigned char __ATTRS_o_ai 9660 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 9661 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9662 (vector int)__b); 9663 } 9664 9665 static __inline__ vector unsigned char __ATTRS_o_ai 9666 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 9667 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9668 (vector int)__b); 9669 } 9670 9671 static __inline__ vector unsigned char __ATTRS_o_ai 9672 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 9673 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9674 (vector int)__b); 9675 } 9676 9677 static __inline__ vector bool char __ATTRS_o_ai 9678 vec_vsl(vector bool char __a, vector unsigned char __b) { 9679 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9680 (vector int)__b); 9681 } 9682 9683 static __inline__ vector bool char __ATTRS_o_ai 9684 vec_vsl(vector bool char __a, vector unsigned short __b) { 9685 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9686 (vector int)__b); 9687 } 9688 9689 static __inline__ vector bool char __ATTRS_o_ai 9690 vec_vsl(vector bool char __a, vector unsigned int __b) { 9691 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9692 (vector int)__b); 9693 } 9694 9695 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9696 vector unsigned char __b) { 9697 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9698 } 9699 9700 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9701 vector unsigned short __b) { 9702 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9703 } 9704 9705 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9706 vector unsigned int __b) { 9707 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9708 } 9709 9710 static __inline__ vector unsigned short __ATTRS_o_ai 9711 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 9712 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9713 (vector int)__b); 9714 } 9715 9716 static __inline__ vector unsigned short __ATTRS_o_ai 9717 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 9718 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9719 (vector int)__b); 9720 } 9721 9722 static __inline__ vector unsigned short __ATTRS_o_ai 9723 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 9724 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9725 (vector int)__b); 9726 } 9727 9728 static __inline__ vector bool short __ATTRS_o_ai 9729 vec_vsl(vector bool short __a, vector unsigned char __b) { 9730 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9731 (vector int)__b); 9732 } 9733 9734 static __inline__ vector bool short __ATTRS_o_ai 9735 vec_vsl(vector bool short __a, vector unsigned short __b) { 9736 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9737 (vector int)__b); 9738 } 9739 9740 static __inline__ vector bool short __ATTRS_o_ai 9741 vec_vsl(vector bool short __a, vector unsigned int __b) { 9742 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9743 (vector int)__b); 9744 } 9745 9746 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9747 vector unsigned char __b) { 9748 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9749 } 9750 9751 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9752 vector unsigned short __b) { 9753 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9754 } 9755 9756 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9757 vector unsigned int __b) { 9758 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9759 } 9760 9761 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9762 vector unsigned char __b) { 9763 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9764 } 9765 9766 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9767 vector unsigned short __b) { 9768 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9769 } 9770 9771 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9772 vector unsigned int __b) { 9773 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9774 } 9775 9776 static __inline__ vector unsigned int __ATTRS_o_ai 9777 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 9778 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9779 (vector int)__b); 9780 } 9781 9782 static __inline__ vector unsigned int __ATTRS_o_ai 9783 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9784 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9785 (vector int)__b); 9786 } 9787 9788 static __inline__ vector unsigned int __ATTRS_o_ai 9789 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9790 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9791 (vector int)__b); 9792 } 9793 9794 static __inline__ vector bool int __ATTRS_o_ai 9795 vec_vsl(vector bool int __a, vector unsigned char __b) { 9796 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9797 (vector int)__b); 9798 } 9799 9800 static __inline__ vector bool int __ATTRS_o_ai 9801 vec_vsl(vector bool int __a, vector unsigned short __b) { 9802 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9803 (vector int)__b); 9804 } 9805 9806 static __inline__ vector bool int __ATTRS_o_ai 9807 vec_vsl(vector bool int __a, vector unsigned int __b) { 9808 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9809 (vector int)__b); 9810 } 9811 9812 /* vec_slo */ 9813 9814 static __inline__ vector signed char __ATTRS_o_ai 9815 vec_slo(vector signed char __a, vector signed char __b) { 9816 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9817 (vector int)__b); 9818 } 9819 9820 static __inline__ vector signed char __ATTRS_o_ai 9821 vec_slo(vector signed char __a, vector unsigned char __b) { 9822 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9823 (vector int)__b); 9824 } 9825 9826 static __inline__ vector unsigned char __ATTRS_o_ai 9827 vec_slo(vector unsigned char __a, vector signed char __b) { 9828 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9829 (vector int)__b); 9830 } 9831 9832 static __inline__ vector unsigned char __ATTRS_o_ai 9833 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9834 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9835 (vector int)__b); 9836 } 9837 9838 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9839 vector signed char __b) { 9840 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9841 } 9842 9843 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9844 vector unsigned char __b) { 9845 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9846 } 9847 9848 static __inline__ vector unsigned short __ATTRS_o_ai 9849 vec_slo(vector unsigned short __a, vector signed char __b) { 9850 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9851 (vector int)__b); 9852 } 9853 9854 static __inline__ vector unsigned short __ATTRS_o_ai 9855 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9856 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9857 (vector int)__b); 9858 } 9859 9860 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9861 vector signed char __b) { 9862 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9863 } 9864 9865 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9866 vector unsigned char __b) { 9867 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9868 } 9869 9870 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9871 vector signed char __b) { 9872 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9873 } 9874 9875 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9876 vector unsigned char __b) { 9877 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9878 } 9879 9880 static __inline__ vector unsigned int __ATTRS_o_ai 9881 vec_slo(vector unsigned int __a, vector signed char __b) { 9882 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9883 (vector int)__b); 9884 } 9885 9886 static __inline__ vector unsigned int __ATTRS_o_ai 9887 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9888 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9889 (vector int)__b); 9890 } 9891 9892 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9893 vector signed char __b) { 9894 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9895 } 9896 9897 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9898 vector unsigned char __b) { 9899 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9900 } 9901 9902 #ifdef __VSX__ 9903 static __inline__ vector signed long long __ATTRS_o_ai 9904 vec_slo(vector signed long long __a, vector signed char __b) { 9905 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9906 (vector int)__b); 9907 } 9908 9909 static __inline__ vector signed long long __ATTRS_o_ai 9910 vec_slo(vector signed long long __a, vector unsigned char __b) { 9911 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9912 (vector int)__b); 9913 } 9914 9915 static __inline__ vector unsigned long long __ATTRS_o_ai 9916 vec_slo(vector unsigned long long __a, vector signed char __b) { 9917 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9918 (vector int)__b); 9919 } 9920 9921 static __inline__ vector unsigned long long __ATTRS_o_ai 9922 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9923 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9924 (vector int)__b); 9925 } 9926 #endif 9927 9928 /* vec_vslo */ 9929 9930 static __inline__ vector signed char __ATTRS_o_ai 9931 vec_vslo(vector signed char __a, vector signed char __b) { 9932 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9933 (vector int)__b); 9934 } 9935 9936 static __inline__ vector signed char __ATTRS_o_ai 9937 vec_vslo(vector signed char __a, vector unsigned char __b) { 9938 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9939 (vector int)__b); 9940 } 9941 9942 static __inline__ vector unsigned char __ATTRS_o_ai 9943 vec_vslo(vector unsigned char __a, vector signed char __b) { 9944 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9945 (vector int)__b); 9946 } 9947 9948 static __inline__ vector unsigned char __ATTRS_o_ai 9949 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 9950 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9951 (vector int)__b); 9952 } 9953 9954 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9955 vector signed char __b) { 9956 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9957 } 9958 9959 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9960 vector unsigned char __b) { 9961 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9962 } 9963 9964 static __inline__ vector unsigned short __ATTRS_o_ai 9965 vec_vslo(vector unsigned short __a, vector signed char __b) { 9966 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9967 (vector int)__b); 9968 } 9969 9970 static __inline__ vector unsigned short __ATTRS_o_ai 9971 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 9972 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9973 (vector int)__b); 9974 } 9975 9976 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9977 vector signed char __b) { 9978 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9979 } 9980 9981 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9982 vector unsigned char __b) { 9983 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9984 } 9985 9986 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9987 vector signed char __b) { 9988 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9989 } 9990 9991 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9992 vector unsigned char __b) { 9993 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9994 } 9995 9996 static __inline__ vector unsigned int __ATTRS_o_ai 9997 vec_vslo(vector unsigned int __a, vector signed char __b) { 9998 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9999 (vector int)__b); 10000 } 10001 10002 static __inline__ vector unsigned int __ATTRS_o_ai 10003 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 10004 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 10005 (vector int)__b); 10006 } 10007 10008 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10009 vector signed char __b) { 10010 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10011 } 10012 10013 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10014 vector unsigned char __b) { 10015 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10016 } 10017 10018 /* vec_splat */ 10019 10020 static __inline__ vector signed char __ATTRS_o_ai 10021 vec_splat(vector signed char __a, unsigned const int __b) { 10022 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10023 } 10024 10025 static __inline__ vector unsigned char __ATTRS_o_ai 10026 vec_splat(vector unsigned char __a, unsigned const int __b) { 10027 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10028 } 10029 10030 static __inline__ vector bool char __ATTRS_o_ai 10031 vec_splat(vector bool char __a, unsigned const int __b) { 10032 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10033 } 10034 10035 static __inline__ vector signed short __ATTRS_o_ai 10036 vec_splat(vector signed short __a, unsigned const int __b) { 10037 unsigned char b0 = (__b & 0x07) * 2; 10038 unsigned char b1 = b0 + 1; 10039 return vec_perm(__a, __a, 10040 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10041 b0, b1, b0, b1, b0, b1)); 10042 } 10043 10044 static __inline__ vector unsigned short __ATTRS_o_ai 10045 vec_splat(vector unsigned short __a, unsigned const int __b) { 10046 unsigned char b0 = (__b & 0x07) * 2; 10047 unsigned char b1 = b0 + 1; 10048 return vec_perm(__a, __a, 10049 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10050 b0, b1, b0, b1, b0, b1)); 10051 } 10052 10053 static __inline__ vector bool short __ATTRS_o_ai 10054 vec_splat(vector bool short __a, unsigned const int __b) { 10055 unsigned char b0 = (__b & 0x07) * 2; 10056 unsigned char b1 = b0 + 1; 10057 return vec_perm(__a, __a, 10058 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10059 b0, b1, b0, b1, b0, b1)); 10060 } 10061 10062 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 10063 unsigned const int __b) { 10064 unsigned char b0 = (__b & 0x07) * 2; 10065 unsigned char b1 = b0 + 1; 10066 return vec_perm(__a, __a, 10067 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10068 b0, b1, b0, b1, b0, b1)); 10069 } 10070 10071 static __inline__ vector signed int __ATTRS_o_ai 10072 vec_splat(vector signed int __a, unsigned const int __b) { 10073 unsigned char b0 = (__b & 0x03) * 4; 10074 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10075 return vec_perm(__a, __a, 10076 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10077 b2, b3, b0, b1, b2, b3)); 10078 } 10079 10080 static __inline__ vector unsigned int __ATTRS_o_ai 10081 vec_splat(vector unsigned int __a, unsigned const int __b) { 10082 unsigned char b0 = (__b & 0x03) * 4; 10083 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10084 return vec_perm(__a, __a, 10085 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10086 b2, b3, b0, b1, b2, b3)); 10087 } 10088 10089 static __inline__ vector bool int __ATTRS_o_ai 10090 vec_splat(vector bool int __a, unsigned const int __b) { 10091 unsigned char b0 = (__b & 0x03) * 4; 10092 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10093 return vec_perm(__a, __a, 10094 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10095 b2, b3, b0, b1, b2, b3)); 10096 } 10097 10098 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 10099 unsigned const int __b) { 10100 unsigned char b0 = (__b & 0x03) * 4; 10101 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10102 return vec_perm(__a, __a, 10103 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10104 b2, b3, b0, b1, b2, b3)); 10105 } 10106 10107 #ifdef __VSX__ 10108 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 10109 unsigned const int __b) { 10110 unsigned char b0 = (__b & 0x01) * 8; 10111 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10112 b6 = b0 + 6, b7 = b0 + 7; 10113 return vec_perm(__a, __a, 10114 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10115 b2, b3, b4, b5, b6, b7)); 10116 } 10117 static __inline__ vector bool long long __ATTRS_o_ai 10118 vec_splat(vector bool long long __a, unsigned const int __b) { 10119 unsigned char b0 = (__b & 0x01) * 8; 10120 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10121 b6 = b0 + 6, b7 = b0 + 7; 10122 return vec_perm(__a, __a, 10123 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10124 b2, b3, b4, b5, b6, b7)); 10125 } 10126 static __inline__ vector signed long long __ATTRS_o_ai 10127 vec_splat(vector signed long long __a, unsigned const int __b) { 10128 unsigned char b0 = (__b & 0x01) * 8; 10129 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10130 b6 = b0 + 6, b7 = b0 + 7; 10131 return vec_perm(__a, __a, 10132 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10133 b2, b3, b4, b5, b6, b7)); 10134 } 10135 static __inline__ vector unsigned long long __ATTRS_o_ai 10136 vec_splat(vector unsigned long long __a, unsigned const int __b) { 10137 unsigned char b0 = (__b & 0x01) * 8; 10138 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10139 b6 = b0 + 6, b7 = b0 + 7; 10140 return vec_perm(__a, __a, 10141 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10142 b2, b3, b4, b5, b6, b7)); 10143 } 10144 #endif 10145 10146 /* vec_vspltb */ 10147 10148 #define __builtin_altivec_vspltb vec_vspltb 10149 10150 static __inline__ vector signed char __ATTRS_o_ai 10151 vec_vspltb(vector signed char __a, unsigned char __b) { 10152 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10153 } 10154 10155 static __inline__ vector unsigned char __ATTRS_o_ai 10156 vec_vspltb(vector unsigned char __a, unsigned char __b) { 10157 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10158 } 10159 10160 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 10161 unsigned char __b) { 10162 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10163 } 10164 10165 /* vec_vsplth */ 10166 10167 #define __builtin_altivec_vsplth vec_vsplth 10168 10169 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 10170 unsigned char __b) { 10171 __b *= 2; 10172 unsigned char b1 = __b + 1; 10173 return vec_perm(__a, __a, 10174 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10175 __b, b1, __b, b1, __b, b1, __b, b1)); 10176 } 10177 10178 static __inline__ vector unsigned short __ATTRS_o_ai 10179 vec_vsplth(vector unsigned short __a, unsigned char __b) { 10180 __b *= 2; 10181 unsigned char b1 = __b + 1; 10182 return vec_perm(__a, __a, 10183 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10184 __b, b1, __b, b1, __b, b1, __b, b1)); 10185 } 10186 10187 static __inline__ vector bool short __ATTRS_o_ai 10188 vec_vsplth(vector bool short __a, unsigned char __b) { 10189 __b *= 2; 10190 unsigned char b1 = __b + 1; 10191 return vec_perm(__a, __a, 10192 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10193 __b, b1, __b, b1, __b, b1, __b, b1)); 10194 } 10195 10196 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 10197 unsigned char __b) { 10198 __b *= 2; 10199 unsigned char b1 = __b + 1; 10200 return vec_perm(__a, __a, 10201 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10202 __b, b1, __b, b1, __b, b1, __b, b1)); 10203 } 10204 10205 /* vec_vspltw */ 10206 10207 #define __builtin_altivec_vspltw vec_vspltw 10208 10209 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 10210 unsigned char __b) { 10211 __b *= 4; 10212 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10213 return vec_perm(__a, __a, 10214 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10215 b1, b2, b3, __b, b1, b2, b3)); 10216 } 10217 10218 static __inline__ vector unsigned int __ATTRS_o_ai 10219 vec_vspltw(vector unsigned int __a, unsigned char __b) { 10220 __b *= 4; 10221 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10222 return vec_perm(__a, __a, 10223 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10224 b1, b2, b3, __b, b1, b2, b3)); 10225 } 10226 10227 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 10228 unsigned char __b) { 10229 __b *= 4; 10230 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10231 return vec_perm(__a, __a, 10232 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10233 b1, b2, b3, __b, b1, b2, b3)); 10234 } 10235 10236 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 10237 unsigned char __b) { 10238 __b *= 4; 10239 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10240 return vec_perm(__a, __a, 10241 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10242 b1, b2, b3, __b, b1, b2, b3)); 10243 } 10244 10245 /* vec_splat_s8 */ 10246 10247 #define __builtin_altivec_vspltisb vec_splat_s8 10248 10249 // FIXME: parameter should be treated as 5-bit signed literal 10250 static __inline__ vector signed char __ATTRS_o_ai 10251 vec_splat_s8(signed char __a) { 10252 return (vector signed char)(__a); 10253 } 10254 10255 /* vec_vspltisb */ 10256 10257 // FIXME: parameter should be treated as 5-bit signed literal 10258 static __inline__ vector signed char __ATTRS_o_ai 10259 vec_vspltisb(signed char __a) { 10260 return (vector signed char)(__a); 10261 } 10262 10263 /* vec_splat_s16 */ 10264 10265 #define __builtin_altivec_vspltish vec_splat_s16 10266 10267 // FIXME: parameter should be treated as 5-bit signed literal 10268 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 10269 return (vector short)(__a); 10270 } 10271 10272 /* vec_vspltish */ 10273 10274 // FIXME: parameter should be treated as 5-bit signed literal 10275 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 10276 return (vector short)(__a); 10277 } 10278 10279 /* vec_splat_s32 */ 10280 10281 #define __builtin_altivec_vspltisw vec_splat_s32 10282 10283 // FIXME: parameter should be treated as 5-bit signed literal 10284 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 10285 return (vector int)(__a); 10286 } 10287 10288 /* vec_vspltisw */ 10289 10290 // FIXME: parameter should be treated as 5-bit signed literal 10291 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 10292 return (vector int)(__a); 10293 } 10294 10295 /* vec_splat_u8 */ 10296 10297 // FIXME: parameter should be treated as 5-bit signed literal 10298 static __inline__ vector unsigned char __ATTRS_o_ai 10299 vec_splat_u8(unsigned char __a) { 10300 return (vector unsigned char)(__a); 10301 } 10302 10303 /* vec_splat_u16 */ 10304 10305 // FIXME: parameter should be treated as 5-bit signed literal 10306 static __inline__ vector unsigned short __ATTRS_o_ai 10307 vec_splat_u16(signed char __a) { 10308 return (vector unsigned short)(__a); 10309 } 10310 10311 /* vec_splat_u32 */ 10312 10313 // FIXME: parameter should be treated as 5-bit signed literal 10314 static __inline__ vector unsigned int __ATTRS_o_ai 10315 vec_splat_u32(signed char __a) { 10316 return (vector unsigned int)(__a); 10317 } 10318 10319 /* vec_sr */ 10320 10321 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 10322 // than the length of __a. 10323 static __inline__ vector unsigned char __ATTRS_o_ai 10324 vec_sr(vector unsigned char __a, vector unsigned char __b) { 10325 return __a >> 10326 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 10327 } 10328 10329 static __inline__ vector signed char __ATTRS_o_ai 10330 vec_sr(vector signed char __a, vector unsigned char __b) { 10331 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 10332 } 10333 10334 static __inline__ vector unsigned short __ATTRS_o_ai 10335 vec_sr(vector unsigned short __a, vector unsigned short __b) { 10336 return __a >> 10337 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 10338 } 10339 10340 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 10341 vector unsigned short __b) { 10342 return (vector short)vec_sr((vector unsigned short)__a, __b); 10343 } 10344 10345 static __inline__ vector unsigned int __ATTRS_o_ai 10346 vec_sr(vector unsigned int __a, vector unsigned int __b) { 10347 return __a >> 10348 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 10349 } 10350 10351 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 10352 vector unsigned int __b) { 10353 return (vector int)vec_sr((vector unsigned int)__a, __b); 10354 } 10355 10356 #ifdef __POWER8_VECTOR__ 10357 static __inline__ vector unsigned long long __ATTRS_o_ai 10358 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10359 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 10360 __CHAR_BIT__)); 10361 } 10362 10363 static __inline__ vector long long __ATTRS_o_ai 10364 vec_sr(vector long long __a, vector unsigned long long __b) { 10365 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10366 } 10367 #elif defined(__VSX__) 10368 static __inline__ vector unsigned long long __ATTRS_o_ai 10369 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10370 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10371 10372 // Big endian element zero (the left doubleword) can be right shifted as-is. 10373 // However the shift amount must be in the right doubleword. 10374 // The other element needs to be swapped into the left doubleword and 10375 // shifted. Then the left doublewords of the two result vectors are merged. 10376 vector unsigned long long __swapshift = 10377 __builtin_shufflevector(__b, __b, 1, 0); 10378 vector unsigned long long __leftelt = 10379 (vector unsigned long long)__builtin_altivec_vsro( 10380 (vector signed int)__a, (vector signed int)__swapshift); 10381 #ifdef __LITTLE_ENDIAN__ 10382 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10383 (vector signed int)__leftelt, 10384 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0)); 10385 #else 10386 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10387 (vector signed int)__leftelt, 10388 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15)); 10389 #endif 10390 __a = __builtin_shufflevector(__a, __a, 1, 0); 10391 vector unsigned long long __rightelt = 10392 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a, 10393 (vector signed int)__b); 10394 #ifdef __LITTLE_ENDIAN__ 10395 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10396 (vector signed int)__rightelt, 10397 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 10398 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3); 10399 #else 10400 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10401 (vector signed int)__rightelt, 10402 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 10403 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2); 10404 #endif 10405 } 10406 10407 static __inline__ vector long long __ATTRS_o_ai 10408 vec_sr(vector long long __a, vector unsigned long long __b) { 10409 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10410 } 10411 #endif /* __VSX__ */ 10412 10413 /* vec_vsrb */ 10414 10415 #define __builtin_altivec_vsrb vec_vsrb 10416 10417 static __inline__ vector signed char __ATTRS_o_ai 10418 vec_vsrb(vector signed char __a, vector unsigned char __b) { 10419 return vec_sr(__a, __b); 10420 } 10421 10422 static __inline__ vector unsigned char __ATTRS_o_ai 10423 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 10424 return vec_sr(__a, __b); 10425 } 10426 10427 /* vec_vsrh */ 10428 10429 #define __builtin_altivec_vsrh vec_vsrh 10430 10431 static __inline__ vector short __ATTRS_o_ai 10432 vec_vsrh(vector short __a, vector unsigned short __b) { 10433 return vec_sr(__a, __b); 10434 } 10435 10436 static __inline__ vector unsigned short __ATTRS_o_ai 10437 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 10438 return vec_sr(__a, __b); 10439 } 10440 10441 /* vec_vsrw */ 10442 10443 #define __builtin_altivec_vsrw vec_vsrw 10444 10445 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 10446 vector unsigned int __b) { 10447 return vec_sr(__a, __b); 10448 } 10449 10450 static __inline__ vector unsigned int __ATTRS_o_ai 10451 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 10452 return vec_sr(__a, __b); 10453 } 10454 10455 /* vec_sra */ 10456 10457 static __inline__ vector signed char __ATTRS_o_ai 10458 vec_sra(vector signed char __a, vector unsigned char __b) { 10459 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10460 } 10461 10462 static __inline__ vector unsigned char __ATTRS_o_ai 10463 vec_sra(vector unsigned char __a, vector unsigned char __b) { 10464 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10465 } 10466 10467 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 10468 vector unsigned short __b) { 10469 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10470 } 10471 10472 static __inline__ vector unsigned short __ATTRS_o_ai 10473 vec_sra(vector unsigned short __a, vector unsigned short __b) { 10474 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10475 } 10476 10477 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 10478 vector unsigned int __b) { 10479 return __builtin_altivec_vsraw(__a, __b); 10480 } 10481 10482 static __inline__ vector unsigned int __ATTRS_o_ai 10483 vec_sra(vector unsigned int __a, vector unsigned int __b) { 10484 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10485 } 10486 10487 #ifdef __POWER8_VECTOR__ 10488 static __inline__ vector signed long long __ATTRS_o_ai 10489 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10490 return __a >> __b; 10491 } 10492 10493 static __inline__ vector unsigned long long __ATTRS_o_ai 10494 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10495 return (vector unsigned long long)((vector signed long long)__a >> __b); 10496 } 10497 #elif defined(__VSX__) 10498 static __inline__ vector signed long long __ATTRS_o_ai 10499 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10500 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10501 return __a >> __b; 10502 } 10503 10504 static __inline__ vector unsigned long long __ATTRS_o_ai 10505 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10506 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10507 return (vector unsigned long long)((vector signed long long)__a >> __b); 10508 } 10509 #endif /* __VSX__ */ 10510 10511 /* vec_vsrab */ 10512 10513 static __inline__ vector signed char __ATTRS_o_ai 10514 vec_vsrab(vector signed char __a, vector unsigned char __b) { 10515 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10516 } 10517 10518 static __inline__ vector unsigned char __ATTRS_o_ai 10519 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 10520 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10521 } 10522 10523 /* vec_vsrah */ 10524 10525 static __inline__ vector short __ATTRS_o_ai 10526 vec_vsrah(vector short __a, vector unsigned short __b) { 10527 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10528 } 10529 10530 static __inline__ vector unsigned short __ATTRS_o_ai 10531 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 10532 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10533 } 10534 10535 /* vec_vsraw */ 10536 10537 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 10538 vector unsigned int __b) { 10539 return __builtin_altivec_vsraw(__a, __b); 10540 } 10541 10542 static __inline__ vector unsigned int __ATTRS_o_ai 10543 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 10544 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10545 } 10546 10547 /* vec_srl */ 10548 10549 static __inline__ vector signed char __ATTRS_o_ai 10550 vec_srl(vector signed char __a, vector unsigned char __b) { 10551 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10552 (vector int)__b); 10553 } 10554 10555 static __inline__ vector signed char __ATTRS_o_ai 10556 vec_srl(vector signed char __a, vector unsigned short __b) { 10557 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10558 (vector int)__b); 10559 } 10560 10561 static __inline__ vector signed char __ATTRS_o_ai 10562 vec_srl(vector signed char __a, vector unsigned int __b) { 10563 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10564 (vector int)__b); 10565 } 10566 10567 static __inline__ vector unsigned char __ATTRS_o_ai 10568 vec_srl(vector unsigned char __a, vector unsigned char __b) { 10569 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10570 (vector int)__b); 10571 } 10572 10573 static __inline__ vector unsigned char __ATTRS_o_ai 10574 vec_srl(vector unsigned char __a, vector unsigned short __b) { 10575 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10576 (vector int)__b); 10577 } 10578 10579 static __inline__ vector unsigned char __ATTRS_o_ai 10580 vec_srl(vector unsigned char __a, vector unsigned int __b) { 10581 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10582 (vector int)__b); 10583 } 10584 10585 static __inline__ vector bool char __ATTRS_o_ai 10586 vec_srl(vector bool char __a, vector unsigned char __b) { 10587 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10588 (vector int)__b); 10589 } 10590 10591 static __inline__ vector bool char __ATTRS_o_ai 10592 vec_srl(vector bool char __a, vector unsigned short __b) { 10593 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10594 (vector int)__b); 10595 } 10596 10597 static __inline__ vector bool char __ATTRS_o_ai 10598 vec_srl(vector bool char __a, vector unsigned int __b) { 10599 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10600 (vector int)__b); 10601 } 10602 10603 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10604 vector unsigned char __b) { 10605 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10606 } 10607 10608 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10609 vector unsigned short __b) { 10610 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10611 } 10612 10613 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10614 vector unsigned int __b) { 10615 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10616 } 10617 10618 static __inline__ vector unsigned short __ATTRS_o_ai 10619 vec_srl(vector unsigned short __a, vector unsigned char __b) { 10620 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10621 (vector int)__b); 10622 } 10623 10624 static __inline__ vector unsigned short __ATTRS_o_ai 10625 vec_srl(vector unsigned short __a, vector unsigned short __b) { 10626 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10627 (vector int)__b); 10628 } 10629 10630 static __inline__ vector unsigned short __ATTRS_o_ai 10631 vec_srl(vector unsigned short __a, vector unsigned int __b) { 10632 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10633 (vector int)__b); 10634 } 10635 10636 static __inline__ vector bool short __ATTRS_o_ai 10637 vec_srl(vector bool short __a, vector unsigned char __b) { 10638 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10639 (vector int)__b); 10640 } 10641 10642 static __inline__ vector bool short __ATTRS_o_ai 10643 vec_srl(vector bool short __a, vector unsigned short __b) { 10644 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10645 (vector int)__b); 10646 } 10647 10648 static __inline__ vector bool short __ATTRS_o_ai 10649 vec_srl(vector bool short __a, vector unsigned int __b) { 10650 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10651 (vector int)__b); 10652 } 10653 10654 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10655 vector unsigned char __b) { 10656 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10657 } 10658 10659 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10660 vector unsigned short __b) { 10661 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10662 } 10663 10664 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10665 vector unsigned int __b) { 10666 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10667 } 10668 10669 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10670 vector unsigned char __b) { 10671 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10672 } 10673 10674 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10675 vector unsigned short __b) { 10676 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10677 } 10678 10679 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10680 vector unsigned int __b) { 10681 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10682 } 10683 10684 static __inline__ vector unsigned int __ATTRS_o_ai 10685 vec_srl(vector unsigned int __a, vector unsigned char __b) { 10686 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10687 (vector int)__b); 10688 } 10689 10690 static __inline__ vector unsigned int __ATTRS_o_ai 10691 vec_srl(vector unsigned int __a, vector unsigned short __b) { 10692 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10693 (vector int)__b); 10694 } 10695 10696 static __inline__ vector unsigned int __ATTRS_o_ai 10697 vec_srl(vector unsigned int __a, vector unsigned int __b) { 10698 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10699 (vector int)__b); 10700 } 10701 10702 static __inline__ vector bool int __ATTRS_o_ai 10703 vec_srl(vector bool int __a, vector unsigned char __b) { 10704 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10705 (vector int)__b); 10706 } 10707 10708 static __inline__ vector bool int __ATTRS_o_ai 10709 vec_srl(vector bool int __a, vector unsigned short __b) { 10710 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10711 (vector int)__b); 10712 } 10713 10714 static __inline__ vector bool int __ATTRS_o_ai 10715 vec_srl(vector bool int __a, vector unsigned int __b) { 10716 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10717 (vector int)__b); 10718 } 10719 10720 #ifdef __VSX__ 10721 static __inline__ vector signed long long __ATTRS_o_ai 10722 vec_srl(vector signed long long __a, vector unsigned char __b) { 10723 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 10724 (vector int)__b); 10725 } 10726 10727 static __inline__ vector unsigned long long __ATTRS_o_ai 10728 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 10729 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 10730 (vector int)__b); 10731 } 10732 #endif 10733 10734 /* vec_vsr */ 10735 10736 static __inline__ vector signed char __ATTRS_o_ai 10737 vec_vsr(vector signed char __a, vector unsigned char __b) { 10738 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10739 (vector int)__b); 10740 } 10741 10742 static __inline__ vector signed char __ATTRS_o_ai 10743 vec_vsr(vector signed char __a, vector unsigned short __b) { 10744 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10745 (vector int)__b); 10746 } 10747 10748 static __inline__ vector signed char __ATTRS_o_ai 10749 vec_vsr(vector signed char __a, vector unsigned int __b) { 10750 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10751 (vector int)__b); 10752 } 10753 10754 static __inline__ vector unsigned char __ATTRS_o_ai 10755 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 10756 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10757 (vector int)__b); 10758 } 10759 10760 static __inline__ vector unsigned char __ATTRS_o_ai 10761 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 10762 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10763 (vector int)__b); 10764 } 10765 10766 static __inline__ vector unsigned char __ATTRS_o_ai 10767 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 10768 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10769 (vector int)__b); 10770 } 10771 10772 static __inline__ vector bool char __ATTRS_o_ai 10773 vec_vsr(vector bool char __a, vector unsigned char __b) { 10774 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10775 (vector int)__b); 10776 } 10777 10778 static __inline__ vector bool char __ATTRS_o_ai 10779 vec_vsr(vector bool char __a, vector unsigned short __b) { 10780 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10781 (vector int)__b); 10782 } 10783 10784 static __inline__ vector bool char __ATTRS_o_ai 10785 vec_vsr(vector bool char __a, vector unsigned int __b) { 10786 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10787 (vector int)__b); 10788 } 10789 10790 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10791 vector unsigned char __b) { 10792 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10793 } 10794 10795 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10796 vector unsigned short __b) { 10797 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10798 } 10799 10800 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10801 vector unsigned int __b) { 10802 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10803 } 10804 10805 static __inline__ vector unsigned short __ATTRS_o_ai 10806 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 10807 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10808 (vector int)__b); 10809 } 10810 10811 static __inline__ vector unsigned short __ATTRS_o_ai 10812 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 10813 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10814 (vector int)__b); 10815 } 10816 10817 static __inline__ vector unsigned short __ATTRS_o_ai 10818 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 10819 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10820 (vector int)__b); 10821 } 10822 10823 static __inline__ vector bool short __ATTRS_o_ai 10824 vec_vsr(vector bool short __a, vector unsigned char __b) { 10825 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10826 (vector int)__b); 10827 } 10828 10829 static __inline__ vector bool short __ATTRS_o_ai 10830 vec_vsr(vector bool short __a, vector unsigned short __b) { 10831 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10832 (vector int)__b); 10833 } 10834 10835 static __inline__ vector bool short __ATTRS_o_ai 10836 vec_vsr(vector bool short __a, vector unsigned int __b) { 10837 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10838 (vector int)__b); 10839 } 10840 10841 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10842 vector unsigned char __b) { 10843 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10844 } 10845 10846 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10847 vector unsigned short __b) { 10848 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10849 } 10850 10851 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10852 vector unsigned int __b) { 10853 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10854 } 10855 10856 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10857 vector unsigned char __b) { 10858 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10859 } 10860 10861 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10862 vector unsigned short __b) { 10863 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10864 } 10865 10866 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10867 vector unsigned int __b) { 10868 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10869 } 10870 10871 static __inline__ vector unsigned int __ATTRS_o_ai 10872 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10873 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10874 (vector int)__b); 10875 } 10876 10877 static __inline__ vector unsigned int __ATTRS_o_ai 10878 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10879 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10880 (vector int)__b); 10881 } 10882 10883 static __inline__ vector unsigned int __ATTRS_o_ai 10884 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10885 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10886 (vector int)__b); 10887 } 10888 10889 static __inline__ vector bool int __ATTRS_o_ai 10890 vec_vsr(vector bool int __a, vector unsigned char __b) { 10891 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10892 (vector int)__b); 10893 } 10894 10895 static __inline__ vector bool int __ATTRS_o_ai 10896 vec_vsr(vector bool int __a, vector unsigned short __b) { 10897 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10898 (vector int)__b); 10899 } 10900 10901 static __inline__ vector bool int __ATTRS_o_ai 10902 vec_vsr(vector bool int __a, vector unsigned int __b) { 10903 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10904 (vector int)__b); 10905 } 10906 10907 /* vec_sro */ 10908 10909 static __inline__ vector signed char __ATTRS_o_ai 10910 vec_sro(vector signed char __a, vector signed char __b) { 10911 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10912 (vector int)__b); 10913 } 10914 10915 static __inline__ vector signed char __ATTRS_o_ai 10916 vec_sro(vector signed char __a, vector unsigned char __b) { 10917 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10918 (vector int)__b); 10919 } 10920 10921 static __inline__ vector unsigned char __ATTRS_o_ai 10922 vec_sro(vector unsigned char __a, vector signed char __b) { 10923 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10924 (vector int)__b); 10925 } 10926 10927 static __inline__ vector unsigned char __ATTRS_o_ai 10928 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10929 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10930 (vector int)__b); 10931 } 10932 10933 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10934 vector signed char __b) { 10935 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10936 } 10937 10938 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10939 vector unsigned char __b) { 10940 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10941 } 10942 10943 static __inline__ vector unsigned short __ATTRS_o_ai 10944 vec_sro(vector unsigned short __a, vector signed char __b) { 10945 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10946 (vector int)__b); 10947 } 10948 10949 static __inline__ vector unsigned short __ATTRS_o_ai 10950 vec_sro(vector unsigned short __a, vector unsigned char __b) { 10951 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10952 (vector int)__b); 10953 } 10954 10955 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10956 vector signed char __b) { 10957 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10958 } 10959 10960 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10961 vector unsigned char __b) { 10962 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10963 } 10964 10965 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10966 vector signed char __b) { 10967 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10968 } 10969 10970 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10971 vector unsigned char __b) { 10972 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10973 } 10974 10975 static __inline__ vector unsigned int __ATTRS_o_ai 10976 vec_sro(vector unsigned int __a, vector signed char __b) { 10977 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10978 (vector int)__b); 10979 } 10980 10981 static __inline__ vector unsigned int __ATTRS_o_ai 10982 vec_sro(vector unsigned int __a, vector unsigned char __b) { 10983 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10984 (vector int)__b); 10985 } 10986 10987 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10988 vector signed char __b) { 10989 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10990 } 10991 10992 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10993 vector unsigned char __b) { 10994 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10995 } 10996 10997 #ifdef __VSX__ 10998 static __inline__ vector signed long long __ATTRS_o_ai 10999 vec_sro(vector signed long long __a, vector signed char __b) { 11000 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 11001 (vector int)__b); 11002 } 11003 11004 static __inline__ vector signed long long __ATTRS_o_ai 11005 vec_sro(vector signed long long __a, vector unsigned char __b) { 11006 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 11007 (vector int)__b); 11008 } 11009 11010 static __inline__ vector unsigned long long __ATTRS_o_ai 11011 vec_sro(vector unsigned long long __a, vector signed char __b) { 11012 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11013 (vector int)__b); 11014 } 11015 11016 static __inline__ vector unsigned long long __ATTRS_o_ai 11017 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 11018 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11019 (vector int)__b); 11020 } 11021 #endif 11022 11023 /* vec_vsro */ 11024 11025 static __inline__ vector signed char __ATTRS_o_ai 11026 vec_vsro(vector signed char __a, vector signed char __b) { 11027 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11028 (vector int)__b); 11029 } 11030 11031 static __inline__ vector signed char __ATTRS_o_ai 11032 vec_vsro(vector signed char __a, vector unsigned char __b) { 11033 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11034 (vector int)__b); 11035 } 11036 11037 static __inline__ vector unsigned char __ATTRS_o_ai 11038 vec_vsro(vector unsigned char __a, vector signed char __b) { 11039 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11040 (vector int)__b); 11041 } 11042 11043 static __inline__ vector unsigned char __ATTRS_o_ai 11044 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 11045 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11046 (vector int)__b); 11047 } 11048 11049 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11050 vector signed char __b) { 11051 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11052 } 11053 11054 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11055 vector unsigned char __b) { 11056 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11057 } 11058 11059 static __inline__ vector unsigned short __ATTRS_o_ai 11060 vec_vsro(vector unsigned short __a, vector signed char __b) { 11061 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11062 (vector int)__b); 11063 } 11064 11065 static __inline__ vector unsigned short __ATTRS_o_ai 11066 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 11067 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11068 (vector int)__b); 11069 } 11070 11071 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11072 vector signed char __b) { 11073 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11074 } 11075 11076 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11077 vector unsigned char __b) { 11078 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11079 } 11080 11081 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11082 vector signed char __b) { 11083 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11084 } 11085 11086 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11087 vector unsigned char __b) { 11088 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11089 } 11090 11091 static __inline__ vector unsigned int __ATTRS_o_ai 11092 vec_vsro(vector unsigned int __a, vector signed char __b) { 11093 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11094 (vector int)__b); 11095 } 11096 11097 static __inline__ vector unsigned int __ATTRS_o_ai 11098 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 11099 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11100 (vector int)__b); 11101 } 11102 11103 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11104 vector signed char __b) { 11105 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11106 } 11107 11108 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11109 vector unsigned char __b) { 11110 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11111 } 11112 11113 /* vec_st */ 11114 11115 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11116 vector signed char *__c) { 11117 __builtin_altivec_stvx((vector int)__a, __b, __c); 11118 } 11119 11120 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11121 signed char *__c) { 11122 __builtin_altivec_stvx((vector int)__a, __b, __c); 11123 } 11124 11125 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11126 vector unsigned char *__c) { 11127 __builtin_altivec_stvx((vector int)__a, __b, __c); 11128 } 11129 11130 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11131 unsigned char *__c) { 11132 __builtin_altivec_stvx((vector int)__a, __b, __c); 11133 } 11134 11135 static __inline__ void __ATTRS_o_ai vec_st(vector bool 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 bool char __a, long __b, 11141 unsigned char *__c) { 11142 __builtin_altivec_stvx((vector int)__a, __b, __c); 11143 } 11144 11145 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11146 vector bool char *__c) { 11147 __builtin_altivec_stvx((vector int)__a, __b, __c); 11148 } 11149 11150 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11151 vector short *__c) { 11152 __builtin_altivec_stvx((vector int)__a, __b, __c); 11153 } 11154 11155 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11156 short *__c) { 11157 __builtin_altivec_stvx((vector int)__a, __b, __c); 11158 } 11159 11160 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11161 vector unsigned short *__c) { 11162 __builtin_altivec_stvx((vector int)__a, __b, __c); 11163 } 11164 11165 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11166 unsigned short *__c) { 11167 __builtin_altivec_stvx((vector int)__a, __b, __c); 11168 } 11169 11170 static __inline__ void __ATTRS_o_ai vec_st(vector bool 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 bool short __a, long __b, 11176 unsigned short *__c) { 11177 __builtin_altivec_stvx((vector int)__a, __b, __c); 11178 } 11179 11180 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11181 vector bool short *__c) { 11182 __builtin_altivec_stvx((vector int)__a, __b, __c); 11183 } 11184 11185 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __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 pixel __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 pixel __a, long __b, 11196 vector pixel *__c) { 11197 __builtin_altivec_stvx((vector int)__a, __b, __c); 11198 } 11199 11200 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, 11201 vector int *__c) { 11202 __builtin_altivec_stvx(__a, __b, __c); 11203 } 11204 11205 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) { 11206 __builtin_altivec_stvx(__a, __b, __c); 11207 } 11208 11209 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11210 vector unsigned int *__c) { 11211 __builtin_altivec_stvx((vector int)__a, __b, __c); 11212 } 11213 11214 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11215 unsigned int *__c) { 11216 __builtin_altivec_stvx((vector int)__a, __b, __c); 11217 } 11218 11219 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11220 int *__c) { 11221 __builtin_altivec_stvx((vector int)__a, __b, __c); 11222 } 11223 11224 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11225 unsigned int *__c) { 11226 __builtin_altivec_stvx((vector int)__a, __b, __c); 11227 } 11228 11229 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11230 vector bool int *__c) { 11231 __builtin_altivec_stvx((vector int)__a, __b, __c); 11232 } 11233 11234 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11235 vector float *__c) { 11236 __builtin_altivec_stvx((vector int)__a, __b, __c); 11237 } 11238 11239 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11240 float *__c) { 11241 __builtin_altivec_stvx((vector int)__a, __b, __c); 11242 } 11243 11244 /* vec_stvx */ 11245 11246 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11247 vector signed char *__c) { 11248 __builtin_altivec_stvx((vector int)__a, __b, __c); 11249 } 11250 11251 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11252 signed char *__c) { 11253 __builtin_altivec_stvx((vector int)__a, __b, __c); 11254 } 11255 11256 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11257 vector unsigned char *__c) { 11258 __builtin_altivec_stvx((vector int)__a, __b, __c); 11259 } 11260 11261 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11262 unsigned char *__c) { 11263 __builtin_altivec_stvx((vector int)__a, __b, __c); 11264 } 11265 11266 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool 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 bool char __a, long __b, 11272 unsigned char *__c) { 11273 __builtin_altivec_stvx((vector int)__a, __b, __c); 11274 } 11275 11276 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11277 vector bool char *__c) { 11278 __builtin_altivec_stvx((vector int)__a, __b, __c); 11279 } 11280 11281 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11282 vector short *__c) { 11283 __builtin_altivec_stvx((vector int)__a, __b, __c); 11284 } 11285 11286 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11287 short *__c) { 11288 __builtin_altivec_stvx((vector int)__a, __b, __c); 11289 } 11290 11291 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11292 vector unsigned short *__c) { 11293 __builtin_altivec_stvx((vector int)__a, __b, __c); 11294 } 11295 11296 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11297 unsigned short *__c) { 11298 __builtin_altivec_stvx((vector int)__a, __b, __c); 11299 } 11300 11301 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool 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 bool short __a, long __b, 11307 unsigned short *__c) { 11308 __builtin_altivec_stvx((vector int)__a, __b, __c); 11309 } 11310 11311 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11312 vector bool short *__c) { 11313 __builtin_altivec_stvx((vector int)__a, __b, __c); 11314 } 11315 11316 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __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 pixel __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 pixel __a, long __b, 11327 vector pixel *__c) { 11328 __builtin_altivec_stvx((vector int)__a, __b, __c); 11329 } 11330 11331 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11332 vector int *__c) { 11333 __builtin_altivec_stvx(__a, __b, __c); 11334 } 11335 11336 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11337 int *__c) { 11338 __builtin_altivec_stvx(__a, __b, __c); 11339 } 11340 11341 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11342 vector unsigned int *__c) { 11343 __builtin_altivec_stvx((vector int)__a, __b, __c); 11344 } 11345 11346 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11347 unsigned int *__c) { 11348 __builtin_altivec_stvx((vector int)__a, __b, __c); 11349 } 11350 11351 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11352 int *__c) { 11353 __builtin_altivec_stvx((vector int)__a, __b, __c); 11354 } 11355 11356 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11357 unsigned int *__c) { 11358 __builtin_altivec_stvx((vector int)__a, __b, __c); 11359 } 11360 11361 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11362 vector bool int *__c) { 11363 __builtin_altivec_stvx((vector int)__a, __b, __c); 11364 } 11365 11366 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11367 vector float *__c) { 11368 __builtin_altivec_stvx((vector int)__a, __b, __c); 11369 } 11370 11371 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11372 float *__c) { 11373 __builtin_altivec_stvx((vector int)__a, __b, __c); 11374 } 11375 11376 /* vec_ste */ 11377 11378 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, 11379 signed char *__c) { 11380 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11381 } 11382 11383 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b, 11384 unsigned char *__c) { 11385 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11386 } 11387 11388 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11389 signed char *__c) { 11390 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11391 } 11392 11393 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11394 unsigned char *__c) { 11395 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11396 } 11397 11398 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b, 11399 short *__c) { 11400 __builtin_altivec_stvehx(__a, __b, __c); 11401 } 11402 11403 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b, 11404 unsigned short *__c) { 11405 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11406 } 11407 11408 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11409 short *__c) { 11410 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11411 } 11412 11413 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11414 unsigned short *__c) { 11415 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11416 } 11417 11418 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11419 short *__c) { 11420 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11421 } 11422 11423 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11424 unsigned short *__c) { 11425 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11426 } 11427 11428 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) { 11429 __builtin_altivec_stvewx(__a, __b, __c); 11430 } 11431 11432 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b, 11433 unsigned int *__c) { 11434 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11435 } 11436 11437 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11438 int *__c) { 11439 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11440 } 11441 11442 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11443 unsigned int *__c) { 11444 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11445 } 11446 11447 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b, 11448 float *__c) { 11449 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11450 } 11451 11452 /* vec_stvebx */ 11453 11454 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, 11455 signed char *__c) { 11456 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11457 } 11458 11459 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 11460 long __b, unsigned char *__c) { 11461 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11462 } 11463 11464 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11465 signed char *__c) { 11466 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11467 } 11468 11469 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11470 unsigned char *__c) { 11471 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11472 } 11473 11474 /* vec_stvehx */ 11475 11476 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, 11477 short *__c) { 11478 __builtin_altivec_stvehx(__a, __b, __c); 11479 } 11480 11481 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 11482 long __b, unsigned short *__c) { 11483 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11484 } 11485 11486 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11487 short *__c) { 11488 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11489 } 11490 11491 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11492 unsigned short *__c) { 11493 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11494 } 11495 11496 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11497 short *__c) { 11498 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11499 } 11500 11501 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11502 unsigned short *__c) { 11503 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11504 } 11505 11506 /* vec_stvewx */ 11507 11508 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, 11509 int *__c) { 11510 __builtin_altivec_stvewx(__a, __b, __c); 11511 } 11512 11513 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b, 11514 unsigned int *__c) { 11515 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11516 } 11517 11518 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11519 int *__c) { 11520 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11521 } 11522 11523 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11524 unsigned int *__c) { 11525 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11526 } 11527 11528 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b, 11529 float *__c) { 11530 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11531 } 11532 11533 /* vec_stl */ 11534 11535 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11536 vector signed char *__c) { 11537 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11538 } 11539 11540 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11541 signed char *__c) { 11542 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11543 } 11544 11545 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11546 vector unsigned char *__c) { 11547 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11548 } 11549 11550 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11551 unsigned char *__c) { 11552 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11553 } 11554 11555 static __inline__ void __ATTRS_o_ai vec_stl(vector bool 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 bool char __a, int __b, 11561 unsigned char *__c) { 11562 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11563 } 11564 11565 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11566 vector bool char *__c) { 11567 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11568 } 11569 11570 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11571 vector short *__c) { 11572 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11573 } 11574 11575 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11576 short *__c) { 11577 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11578 } 11579 11580 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11581 vector unsigned short *__c) { 11582 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11583 } 11584 11585 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11586 unsigned short *__c) { 11587 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11588 } 11589 11590 static __inline__ void __ATTRS_o_ai vec_stl(vector bool 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 bool short __a, int __b, 11596 unsigned short *__c) { 11597 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11598 } 11599 11600 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11601 vector bool short *__c) { 11602 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11603 } 11604 11605 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __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 pixel __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 pixel __a, int __b, 11616 vector pixel *__c) { 11617 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11618 } 11619 11620 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 11621 vector int *__c) { 11622 __builtin_altivec_stvxl(__a, __b, __c); 11623 } 11624 11625 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 11626 __builtin_altivec_stvxl(__a, __b, __c); 11627 } 11628 11629 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11630 vector unsigned int *__c) { 11631 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11632 } 11633 11634 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11635 unsigned int *__c) { 11636 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11637 } 11638 11639 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11640 int *__c) { 11641 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11642 } 11643 11644 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11645 unsigned int *__c) { 11646 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11647 } 11648 11649 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11650 vector bool int *__c) { 11651 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11652 } 11653 11654 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11655 vector float *__c) { 11656 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11657 } 11658 11659 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11660 float *__c) { 11661 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11662 } 11663 11664 /* vec_stvxl */ 11665 11666 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11667 vector signed char *__c) { 11668 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11669 } 11670 11671 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11672 signed char *__c) { 11673 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11674 } 11675 11676 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11677 vector unsigned char *__c) { 11678 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11679 } 11680 11681 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11682 unsigned char *__c) { 11683 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11684 } 11685 11686 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool 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 bool char __a, int __b, 11692 unsigned char *__c) { 11693 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11694 } 11695 11696 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11697 vector bool char *__c) { 11698 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11699 } 11700 11701 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11702 vector short *__c) { 11703 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11704 } 11705 11706 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11707 short *__c) { 11708 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11709 } 11710 11711 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11712 int __b, 11713 vector unsigned short *__c) { 11714 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11715 } 11716 11717 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11718 int __b, unsigned short *__c) { 11719 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11720 } 11721 11722 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11723 short *__c) { 11724 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11725 } 11726 11727 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11728 unsigned short *__c) { 11729 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11730 } 11731 11732 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11733 vector bool short *__c) { 11734 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11735 } 11736 11737 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __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 pixel __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 pixel __a, int __b, 11748 vector pixel *__c) { 11749 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11750 } 11751 11752 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11753 vector int *__c) { 11754 __builtin_altivec_stvxl(__a, __b, __c); 11755 } 11756 11757 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11758 int *__c) { 11759 __builtin_altivec_stvxl(__a, __b, __c); 11760 } 11761 11762 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11763 vector unsigned int *__c) { 11764 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11765 } 11766 11767 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11768 unsigned int *__c) { 11769 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11770 } 11771 11772 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11773 int *__c) { 11774 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11775 } 11776 11777 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11778 unsigned int *__c) { 11779 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11780 } 11781 11782 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11783 vector bool int *__c) { 11784 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11785 } 11786 11787 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11788 vector float *__c) { 11789 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11790 } 11791 11792 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11793 float *__c) { 11794 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11795 } 11796 11797 /* vec_sub */ 11798 11799 static __inline__ vector signed char __ATTRS_o_ai 11800 vec_sub(vector signed char __a, vector signed char __b) { 11801 return __a - __b; 11802 } 11803 11804 static __inline__ vector signed char __ATTRS_o_ai 11805 vec_sub(vector bool char __a, vector signed char __b) { 11806 return (vector signed char)__a - __b; 11807 } 11808 11809 static __inline__ vector signed char __ATTRS_o_ai 11810 vec_sub(vector signed char __a, vector bool char __b) { 11811 return __a - (vector signed char)__b; 11812 } 11813 11814 static __inline__ vector unsigned char __ATTRS_o_ai 11815 vec_sub(vector unsigned char __a, vector unsigned char __b) { 11816 return __a - __b; 11817 } 11818 11819 static __inline__ vector unsigned char __ATTRS_o_ai 11820 vec_sub(vector bool char __a, vector unsigned char __b) { 11821 return (vector unsigned char)__a - __b; 11822 } 11823 11824 static __inline__ vector unsigned char __ATTRS_o_ai 11825 vec_sub(vector unsigned char __a, vector bool char __b) { 11826 return __a - (vector unsigned char)__b; 11827 } 11828 11829 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11830 vector short __b) { 11831 return __a - __b; 11832 } 11833 11834 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 11835 vector short __b) { 11836 return (vector short)__a - __b; 11837 } 11838 11839 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11840 vector bool short __b) { 11841 return __a - (vector short)__b; 11842 } 11843 11844 static __inline__ vector unsigned short __ATTRS_o_ai 11845 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11846 return __a - __b; 11847 } 11848 11849 static __inline__ vector unsigned short __ATTRS_o_ai 11850 vec_sub(vector bool short __a, vector unsigned short __b) { 11851 return (vector unsigned short)__a - __b; 11852 } 11853 11854 static __inline__ vector unsigned short __ATTRS_o_ai 11855 vec_sub(vector unsigned short __a, vector bool short __b) { 11856 return __a - (vector unsigned short)__b; 11857 } 11858 11859 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11860 vector int __b) { 11861 return __a - __b; 11862 } 11863 11864 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11865 vector int __b) { 11866 return (vector int)__a - __b; 11867 } 11868 11869 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11870 vector bool int __b) { 11871 return __a - (vector int)__b; 11872 } 11873 11874 static __inline__ vector unsigned int __ATTRS_o_ai 11875 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11876 return __a - __b; 11877 } 11878 11879 static __inline__ vector unsigned int __ATTRS_o_ai 11880 vec_sub(vector bool int __a, vector unsigned int __b) { 11881 return (vector unsigned int)__a - __b; 11882 } 11883 11884 static __inline__ vector unsigned int __ATTRS_o_ai 11885 vec_sub(vector unsigned int __a, vector bool int __b) { 11886 return __a - (vector unsigned int)__b; 11887 } 11888 11889 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 11890 defined(__SIZEOF_INT128__) 11891 static __inline__ vector signed __int128 __ATTRS_o_ai 11892 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11893 return __a - __b; 11894 } 11895 11896 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11897 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11898 return __a - __b; 11899 } 11900 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) && 11901 // defined(__SIZEOF_INT128__) 11902 11903 #ifdef __VSX__ 11904 static __inline__ vector signed long long __ATTRS_o_ai 11905 vec_sub(vector signed long long __a, vector signed long long __b) { 11906 return __a - __b; 11907 } 11908 11909 static __inline__ vector unsigned long long __ATTRS_o_ai 11910 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11911 return __a - __b; 11912 } 11913 11914 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11915 vector double __b) { 11916 return __a - __b; 11917 } 11918 #endif 11919 11920 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11921 vector float __b) { 11922 return __a - __b; 11923 } 11924 11925 /* vec_vsububm */ 11926 11927 #define __builtin_altivec_vsububm vec_vsububm 11928 11929 static __inline__ vector signed char __ATTRS_o_ai 11930 vec_vsububm(vector signed char __a, vector signed char __b) { 11931 return __a - __b; 11932 } 11933 11934 static __inline__ vector signed char __ATTRS_o_ai 11935 vec_vsububm(vector bool char __a, vector signed char __b) { 11936 return (vector signed char)__a - __b; 11937 } 11938 11939 static __inline__ vector signed char __ATTRS_o_ai 11940 vec_vsububm(vector signed char __a, vector bool char __b) { 11941 return __a - (vector signed char)__b; 11942 } 11943 11944 static __inline__ vector unsigned char __ATTRS_o_ai 11945 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 11946 return __a - __b; 11947 } 11948 11949 static __inline__ vector unsigned char __ATTRS_o_ai 11950 vec_vsububm(vector bool char __a, vector unsigned char __b) { 11951 return (vector unsigned char)__a - __b; 11952 } 11953 11954 static __inline__ vector unsigned char __ATTRS_o_ai 11955 vec_vsububm(vector unsigned char __a, vector bool char __b) { 11956 return __a - (vector unsigned char)__b; 11957 } 11958 11959 /* vec_vsubuhm */ 11960 11961 #define __builtin_altivec_vsubuhm vec_vsubuhm 11962 11963 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11964 vector short __b) { 11965 return __a - __b; 11966 } 11967 11968 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 11969 vector short __b) { 11970 return (vector short)__a - __b; 11971 } 11972 11973 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11974 vector bool short __b) { 11975 return __a - (vector short)__b; 11976 } 11977 11978 static __inline__ vector unsigned short __ATTRS_o_ai 11979 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 11980 return __a - __b; 11981 } 11982 11983 static __inline__ vector unsigned short __ATTRS_o_ai 11984 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 11985 return (vector unsigned short)__a - __b; 11986 } 11987 11988 static __inline__ vector unsigned short __ATTRS_o_ai 11989 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 11990 return __a - (vector unsigned short)__b; 11991 } 11992 11993 /* vec_vsubuwm */ 11994 11995 #define __builtin_altivec_vsubuwm vec_vsubuwm 11996 11997 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11998 vector int __b) { 11999 return __a - __b; 12000 } 12001 12002 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 12003 vector int __b) { 12004 return (vector int)__a - __b; 12005 } 12006 12007 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 12008 vector bool int __b) { 12009 return __a - (vector int)__b; 12010 } 12011 12012 static __inline__ vector unsigned int __ATTRS_o_ai 12013 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 12014 return __a - __b; 12015 } 12016 12017 static __inline__ vector unsigned int __ATTRS_o_ai 12018 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 12019 return (vector unsigned int)__a - __b; 12020 } 12021 12022 static __inline__ vector unsigned int __ATTRS_o_ai 12023 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 12024 return __a - (vector unsigned int)__b; 12025 } 12026 12027 /* vec_vsubfp */ 12028 12029 #define __builtin_altivec_vsubfp vec_vsubfp 12030 12031 static __inline__ vector float __attribute__((__always_inline__)) 12032 vec_vsubfp(vector float __a, vector float __b) { 12033 return __a - __b; 12034 } 12035 12036 /* vec_subc */ 12037 12038 static __inline__ vector signed int __ATTRS_o_ai 12039 vec_subc(vector signed int __a, vector signed int __b) { 12040 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 12041 (vector unsigned int) __b); 12042 } 12043 12044 static __inline__ vector unsigned int __ATTRS_o_ai 12045 vec_subc(vector unsigned int __a, vector unsigned int __b) { 12046 return __builtin_altivec_vsubcuw(__a, __b); 12047 } 12048 12049 #ifdef __POWER8_VECTOR__ 12050 #ifdef __SIZEOF_INT128__ 12051 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12052 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12053 return __builtin_altivec_vsubcuq(__a, __b); 12054 } 12055 12056 static __inline__ vector signed __int128 __ATTRS_o_ai 12057 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 12058 return __builtin_altivec_vsubcuq(__a, __b); 12059 } 12060 #endif 12061 12062 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12063 vec_subc_u128(vector unsigned char __a, vector unsigned char __b) { 12064 return (vector unsigned char)__builtin_altivec_vsubcuq(__a, __b); 12065 } 12066 #endif // __POWER8_VECTOR__ 12067 12068 /* vec_vsubcuw */ 12069 12070 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12071 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 12072 return __builtin_altivec_vsubcuw(__a, __b); 12073 } 12074 12075 /* vec_subs */ 12076 12077 static __inline__ vector signed char __ATTRS_o_ai 12078 vec_subs(vector signed char __a, vector signed char __b) { 12079 return __builtin_altivec_vsubsbs(__a, __b); 12080 } 12081 12082 static __inline__ vector signed char __ATTRS_o_ai 12083 vec_subs(vector bool char __a, vector signed char __b) { 12084 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12085 } 12086 12087 static __inline__ vector signed char __ATTRS_o_ai 12088 vec_subs(vector signed char __a, vector bool char __b) { 12089 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12090 } 12091 12092 static __inline__ vector unsigned char __ATTRS_o_ai 12093 vec_subs(vector unsigned char __a, vector unsigned char __b) { 12094 return __builtin_altivec_vsububs(__a, __b); 12095 } 12096 12097 static __inline__ vector unsigned char __ATTRS_o_ai 12098 vec_subs(vector bool char __a, vector unsigned char __b) { 12099 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12100 } 12101 12102 static __inline__ vector unsigned char __ATTRS_o_ai 12103 vec_subs(vector unsigned char __a, vector bool char __b) { 12104 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12105 } 12106 12107 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12108 vector short __b) { 12109 return __builtin_altivec_vsubshs(__a, __b); 12110 } 12111 12112 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 12113 vector short __b) { 12114 return __builtin_altivec_vsubshs((vector short)__a, __b); 12115 } 12116 12117 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12118 vector bool short __b) { 12119 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12120 } 12121 12122 static __inline__ vector unsigned short __ATTRS_o_ai 12123 vec_subs(vector unsigned short __a, vector unsigned short __b) { 12124 return __builtin_altivec_vsubuhs(__a, __b); 12125 } 12126 12127 static __inline__ vector unsigned short __ATTRS_o_ai 12128 vec_subs(vector bool short __a, vector unsigned short __b) { 12129 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12130 } 12131 12132 static __inline__ vector unsigned short __ATTRS_o_ai 12133 vec_subs(vector unsigned short __a, vector bool short __b) { 12134 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12135 } 12136 12137 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12138 vector int __b) { 12139 return __builtin_altivec_vsubsws(__a, __b); 12140 } 12141 12142 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 12143 vector int __b) { 12144 return __builtin_altivec_vsubsws((vector int)__a, __b); 12145 } 12146 12147 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12148 vector bool int __b) { 12149 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12150 } 12151 12152 static __inline__ vector unsigned int __ATTRS_o_ai 12153 vec_subs(vector unsigned int __a, vector unsigned int __b) { 12154 return __builtin_altivec_vsubuws(__a, __b); 12155 } 12156 12157 static __inline__ vector unsigned int __ATTRS_o_ai 12158 vec_subs(vector bool int __a, vector unsigned int __b) { 12159 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12160 } 12161 12162 static __inline__ vector unsigned int __ATTRS_o_ai 12163 vec_subs(vector unsigned int __a, vector bool int __b) { 12164 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12165 } 12166 12167 /* vec_vsubsbs */ 12168 12169 static __inline__ vector signed char __ATTRS_o_ai 12170 vec_vsubsbs(vector signed char __a, vector signed char __b) { 12171 return __builtin_altivec_vsubsbs(__a, __b); 12172 } 12173 12174 static __inline__ vector signed char __ATTRS_o_ai 12175 vec_vsubsbs(vector bool char __a, vector signed char __b) { 12176 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12177 } 12178 12179 static __inline__ vector signed char __ATTRS_o_ai 12180 vec_vsubsbs(vector signed char __a, vector bool char __b) { 12181 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12182 } 12183 12184 /* vec_vsububs */ 12185 12186 static __inline__ vector unsigned char __ATTRS_o_ai 12187 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 12188 return __builtin_altivec_vsububs(__a, __b); 12189 } 12190 12191 static __inline__ vector unsigned char __ATTRS_o_ai 12192 vec_vsububs(vector bool char __a, vector unsigned char __b) { 12193 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12194 } 12195 12196 static __inline__ vector unsigned char __ATTRS_o_ai 12197 vec_vsububs(vector unsigned char __a, vector bool char __b) { 12198 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12199 } 12200 12201 /* vec_vsubshs */ 12202 12203 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12204 vector short __b) { 12205 return __builtin_altivec_vsubshs(__a, __b); 12206 } 12207 12208 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 12209 vector short __b) { 12210 return __builtin_altivec_vsubshs((vector short)__a, __b); 12211 } 12212 12213 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12214 vector bool short __b) { 12215 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12216 } 12217 12218 /* vec_vsubuhs */ 12219 12220 static __inline__ vector unsigned short __ATTRS_o_ai 12221 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 12222 return __builtin_altivec_vsubuhs(__a, __b); 12223 } 12224 12225 static __inline__ vector unsigned short __ATTRS_o_ai 12226 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 12227 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12228 } 12229 12230 static __inline__ vector unsigned short __ATTRS_o_ai 12231 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 12232 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12233 } 12234 12235 /* vec_vsubsws */ 12236 12237 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12238 vector int __b) { 12239 return __builtin_altivec_vsubsws(__a, __b); 12240 } 12241 12242 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 12243 vector int __b) { 12244 return __builtin_altivec_vsubsws((vector int)__a, __b); 12245 } 12246 12247 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12248 vector bool int __b) { 12249 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12250 } 12251 12252 /* vec_vsubuws */ 12253 12254 static __inline__ vector unsigned int __ATTRS_o_ai 12255 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 12256 return __builtin_altivec_vsubuws(__a, __b); 12257 } 12258 12259 static __inline__ vector unsigned int __ATTRS_o_ai 12260 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 12261 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12262 } 12263 12264 static __inline__ vector unsigned int __ATTRS_o_ai 12265 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 12266 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12267 } 12268 12269 #ifdef __POWER8_VECTOR__ 12270 /* vec_vsubuqm */ 12271 12272 #ifdef __SIZEOF_INT128__ 12273 static __inline__ vector signed __int128 __ATTRS_o_ai 12274 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 12275 return __a - __b; 12276 } 12277 12278 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12279 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12280 return __a - __b; 12281 } 12282 #endif 12283 12284 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12285 vec_sub_u128(vector unsigned char __a, vector unsigned char __b) { 12286 return __builtin_altivec_vsubuqm(__a, __b); 12287 } 12288 12289 /* vec_vsubeuqm */ 12290 12291 #ifdef __SIZEOF_INT128__ 12292 static __inline__ vector signed __int128 __ATTRS_o_ai 12293 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 12294 vector signed __int128 __c) { 12295 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12296 } 12297 12298 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12299 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 12300 vector unsigned __int128 __c) { 12301 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12302 } 12303 12304 static __inline__ vector signed __int128 __ATTRS_o_ai 12305 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 12306 vector signed __int128 __c) { 12307 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12308 } 12309 12310 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12311 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 12312 vector unsigned __int128 __c) { 12313 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12314 } 12315 #endif 12316 12317 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12318 vec_sube_u128(vector unsigned char __a, vector unsigned char __b, 12319 vector unsigned char __c) { 12320 return (vector unsigned char)__builtin_altivec_vsubeuqm(__a, __b, __c); 12321 } 12322 12323 /* vec_vsubcuq */ 12324 12325 #ifdef __SIZEOF_INT128__ 12326 static __inline__ vector signed __int128 __ATTRS_o_ai 12327 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 12328 return __builtin_altivec_vsubcuq(__a, __b); 12329 } 12330 12331 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12332 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12333 return __builtin_altivec_vsubcuq(__a, __b); 12334 } 12335 12336 /* vec_vsubecuq */ 12337 12338 static __inline__ vector signed __int128 __ATTRS_o_ai 12339 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 12340 vector signed __int128 __c) { 12341 return __builtin_altivec_vsubecuq(__a, __b, __c); 12342 } 12343 12344 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12345 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 12346 vector unsigned __int128 __c) { 12347 return __builtin_altivec_vsubecuq(__a, __b, __c); 12348 } 12349 #endif 12350 12351 #ifdef __powerpc64__ 12352 static __inline__ vector signed int __ATTRS_o_ai 12353 vec_subec(vector signed int __a, vector signed int __b, 12354 vector signed int __c) { 12355 return vec_addec(__a, ~__b, __c); 12356 } 12357 12358 static __inline__ vector unsigned int __ATTRS_o_ai 12359 vec_subec(vector unsigned int __a, vector unsigned int __b, 12360 vector unsigned int __c) { 12361 return vec_addec(__a, ~__b, __c); 12362 } 12363 #endif 12364 12365 #ifdef __SIZEOF_INT128__ 12366 static __inline__ vector signed __int128 __ATTRS_o_ai 12367 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 12368 vector signed __int128 __c) { 12369 return __builtin_altivec_vsubecuq(__a, __b, __c); 12370 } 12371 12372 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12373 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 12374 vector unsigned __int128 __c) { 12375 return __builtin_altivec_vsubecuq(__a, __b, __c); 12376 } 12377 #endif 12378 12379 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12380 vec_subec_u128(vector unsigned char __a, vector unsigned char __b, 12381 vector unsigned char __c) { 12382 return (vector unsigned char)__builtin_altivec_vsubecuq(__a, __b, __c); 12383 } 12384 #endif // __POWER8_VECTOR__ 12385 12386 static __inline__ vector signed int __ATTRS_o_ai 12387 vec_sube(vector signed int __a, vector signed int __b, 12388 vector signed int __c) { 12389 vector signed int __mask = {1, 1, 1, 1}; 12390 vector signed int __carry = __c & __mask; 12391 return vec_adde(__a, ~__b, __carry); 12392 } 12393 12394 static __inline__ vector unsigned int __ATTRS_o_ai 12395 vec_sube(vector unsigned int __a, vector unsigned int __b, 12396 vector unsigned int __c) { 12397 vector unsigned int __mask = {1, 1, 1, 1}; 12398 vector unsigned int __carry = __c & __mask; 12399 return vec_adde(__a, ~__b, __carry); 12400 } 12401 /* vec_sum4s */ 12402 12403 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 12404 vector int __b) { 12405 return __builtin_altivec_vsum4sbs(__a, __b); 12406 } 12407 12408 static __inline__ vector unsigned int __ATTRS_o_ai 12409 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 12410 return __builtin_altivec_vsum4ubs(__a, __b); 12411 } 12412 12413 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 12414 vector int __b) { 12415 return __builtin_altivec_vsum4shs(__a, __b); 12416 } 12417 12418 /* vec_vsum4sbs */ 12419 12420 static __inline__ vector int __attribute__((__always_inline__)) 12421 vec_vsum4sbs(vector signed char __a, vector int __b) { 12422 return __builtin_altivec_vsum4sbs(__a, __b); 12423 } 12424 12425 /* vec_vsum4ubs */ 12426 12427 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12428 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 12429 return __builtin_altivec_vsum4ubs(__a, __b); 12430 } 12431 12432 /* vec_vsum4shs */ 12433 12434 static __inline__ vector int __attribute__((__always_inline__)) 12435 vec_vsum4shs(vector signed short __a, vector int __b) { 12436 return __builtin_altivec_vsum4shs(__a, __b); 12437 } 12438 12439 /* vec_sum2s */ 12440 12441 /* The vsum2sws instruction has a big-endian bias, so that the second 12442 input vector and the result always reference big-endian elements 12443 1 and 3 (little-endian element 0 and 2). For ease of porting the 12444 programmer wants elements 1 and 3 in both cases, so for little 12445 endian we must perform some permutes. */ 12446 12447 static __inline__ vector signed int __attribute__((__always_inline__)) 12448 vec_sum2s(vector int __a, vector int __b) { 12449 #ifdef __LITTLE_ENDIAN__ 12450 vector int __c = (vector signed int)vec_perm( 12451 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12452 8, 9, 10, 11)); 12453 __c = __builtin_altivec_vsum2sws(__a, __c); 12454 return (vector signed int)vec_perm( 12455 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12456 8, 9, 10, 11)); 12457 #else 12458 return __builtin_altivec_vsum2sws(__a, __b); 12459 #endif 12460 } 12461 12462 /* vec_vsum2sws */ 12463 12464 static __inline__ vector signed int __attribute__((__always_inline__)) 12465 vec_vsum2sws(vector int __a, vector int __b) { 12466 #ifdef __LITTLE_ENDIAN__ 12467 vector int __c = (vector signed int)vec_perm( 12468 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12469 8, 9, 10, 11)); 12470 __c = __builtin_altivec_vsum2sws(__a, __c); 12471 return (vector signed int)vec_perm( 12472 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12473 8, 9, 10, 11)); 12474 #else 12475 return __builtin_altivec_vsum2sws(__a, __b); 12476 #endif 12477 } 12478 12479 /* vec_sums */ 12480 12481 /* The vsumsws instruction has a big-endian bias, so that the second 12482 input vector and the result always reference big-endian element 3 12483 (little-endian element 0). For ease of porting the programmer 12484 wants element 3 in both cases, so for little endian we must perform 12485 some permutes. */ 12486 12487 static __inline__ vector signed int __attribute__((__always_inline__)) 12488 vec_sums(vector signed int __a, vector signed int __b) { 12489 #ifdef __LITTLE_ENDIAN__ 12490 __b = (vector signed int)vec_splat(__b, 3); 12491 __b = __builtin_altivec_vsumsws(__a, __b); 12492 return (vector signed int)(0, 0, 0, __b[0]); 12493 #else 12494 return __builtin_altivec_vsumsws(__a, __b); 12495 #endif 12496 } 12497 12498 /* vec_vsumsws */ 12499 12500 static __inline__ vector signed int __attribute__((__always_inline__)) 12501 vec_vsumsws(vector signed int __a, vector signed int __b) { 12502 #ifdef __LITTLE_ENDIAN__ 12503 __b = (vector signed int)vec_splat(__b, 3); 12504 __b = __builtin_altivec_vsumsws(__a, __b); 12505 return (vector signed int)(0, 0, 0, __b[0]); 12506 #else 12507 return __builtin_altivec_vsumsws(__a, __b); 12508 #endif 12509 } 12510 12511 /* vec_trunc */ 12512 12513 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 12514 #ifdef __VSX__ 12515 return __builtin_vsx_xvrspiz(__a); 12516 #else 12517 return __builtin_altivec_vrfiz(__a); 12518 #endif 12519 } 12520 12521 #ifdef __VSX__ 12522 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 12523 return __builtin_vsx_xvrdpiz(__a); 12524 } 12525 #endif 12526 12527 /* vec_roundz */ 12528 static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) { 12529 return vec_trunc(__a); 12530 } 12531 12532 #ifdef __VSX__ 12533 static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) { 12534 return vec_trunc(__a); 12535 } 12536 #endif 12537 12538 /* vec_vrfiz */ 12539 12540 static __inline__ vector float __attribute__((__always_inline__)) 12541 vec_vrfiz(vector float __a) { 12542 return __builtin_altivec_vrfiz(__a); 12543 } 12544 12545 /* vec_unpackh */ 12546 12547 /* The vector unpack instructions all have a big-endian bias, so for 12548 little endian we must reverse the meanings of "high" and "low." */ 12549 #ifdef __LITTLE_ENDIAN__ 12550 #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12551 #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12552 #else 12553 #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12554 #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12555 #endif 12556 12557 static __inline__ vector short __ATTRS_o_ai 12558 vec_unpackh(vector signed char __a) { 12559 #ifdef __LITTLE_ENDIAN__ 12560 return __builtin_altivec_vupklsb((vector char)__a); 12561 #else 12562 return __builtin_altivec_vupkhsb((vector char)__a); 12563 #endif 12564 } 12565 12566 static __inline__ vector bool short __ATTRS_o_ai 12567 vec_unpackh(vector bool char __a) { 12568 #ifdef __LITTLE_ENDIAN__ 12569 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12570 #else 12571 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12572 #endif 12573 } 12574 12575 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 12576 #ifdef __LITTLE_ENDIAN__ 12577 return __builtin_altivec_vupklsh(__a); 12578 #else 12579 return __builtin_altivec_vupkhsh(__a); 12580 #endif 12581 } 12582 12583 static __inline__ vector bool int __ATTRS_o_ai 12584 vec_unpackh(vector bool short __a) { 12585 #ifdef __LITTLE_ENDIAN__ 12586 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12587 #else 12588 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12589 #endif 12590 } 12591 12592 static __inline__ vector unsigned int __ATTRS_o_ai 12593 vec_unpackh(vector pixel __a) { 12594 #ifdef __LITTLE_ENDIAN__ 12595 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12596 #else 12597 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12598 #endif 12599 } 12600 12601 #ifdef __POWER8_VECTOR__ 12602 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 12603 #ifdef __LITTLE_ENDIAN__ 12604 return __builtin_altivec_vupklsw(__a); 12605 #else 12606 return __builtin_altivec_vupkhsw(__a); 12607 #endif 12608 } 12609 12610 static __inline__ vector bool long long __ATTRS_o_ai 12611 vec_unpackh(vector bool int __a) { 12612 #ifdef __LITTLE_ENDIAN__ 12613 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12614 #else 12615 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12616 #endif 12617 } 12618 12619 static __inline__ vector double __ATTRS_o_ai 12620 vec_unpackh(vector float __a) { 12621 return (vector double)(__a[0], __a[1]); 12622 } 12623 #endif 12624 12625 /* vec_vupkhsb */ 12626 12627 static __inline__ vector short __ATTRS_o_ai 12628 vec_vupkhsb(vector signed char __a) { 12629 #ifdef __LITTLE_ENDIAN__ 12630 return __builtin_altivec_vupklsb((vector char)__a); 12631 #else 12632 return __builtin_altivec_vupkhsb((vector char)__a); 12633 #endif 12634 } 12635 12636 static __inline__ vector bool short __ATTRS_o_ai 12637 vec_vupkhsb(vector bool char __a) { 12638 #ifdef __LITTLE_ENDIAN__ 12639 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12640 #else 12641 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12642 #endif 12643 } 12644 12645 /* vec_vupkhsh */ 12646 12647 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 12648 #ifdef __LITTLE_ENDIAN__ 12649 return __builtin_altivec_vupklsh(__a); 12650 #else 12651 return __builtin_altivec_vupkhsh(__a); 12652 #endif 12653 } 12654 12655 static __inline__ vector bool int __ATTRS_o_ai 12656 vec_vupkhsh(vector bool short __a) { 12657 #ifdef __LITTLE_ENDIAN__ 12658 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12659 #else 12660 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12661 #endif 12662 } 12663 12664 static __inline__ vector unsigned int __ATTRS_o_ai 12665 vec_vupkhsh(vector pixel __a) { 12666 #ifdef __LITTLE_ENDIAN__ 12667 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12668 #else 12669 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12670 #endif 12671 } 12672 12673 /* vec_vupkhsw */ 12674 12675 #ifdef __POWER8_VECTOR__ 12676 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 12677 #ifdef __LITTLE_ENDIAN__ 12678 return __builtin_altivec_vupklsw(__a); 12679 #else 12680 return __builtin_altivec_vupkhsw(__a); 12681 #endif 12682 } 12683 12684 static __inline__ vector bool long long __ATTRS_o_ai 12685 vec_vupkhsw(vector bool int __a) { 12686 #ifdef __LITTLE_ENDIAN__ 12687 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12688 #else 12689 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12690 #endif 12691 } 12692 #endif 12693 12694 /* vec_unpackl */ 12695 12696 static __inline__ vector short __ATTRS_o_ai 12697 vec_unpackl(vector signed char __a) { 12698 #ifdef __LITTLE_ENDIAN__ 12699 return __builtin_altivec_vupkhsb((vector char)__a); 12700 #else 12701 return __builtin_altivec_vupklsb((vector char)__a); 12702 #endif 12703 } 12704 12705 static __inline__ vector bool short __ATTRS_o_ai 12706 vec_unpackl(vector bool char __a) { 12707 #ifdef __LITTLE_ENDIAN__ 12708 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12709 #else 12710 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12711 #endif 12712 } 12713 12714 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 12715 #ifdef __LITTLE_ENDIAN__ 12716 return __builtin_altivec_vupkhsh(__a); 12717 #else 12718 return __builtin_altivec_vupklsh(__a); 12719 #endif 12720 } 12721 12722 static __inline__ vector bool int __ATTRS_o_ai 12723 vec_unpackl(vector bool short __a) { 12724 #ifdef __LITTLE_ENDIAN__ 12725 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12726 #else 12727 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12728 #endif 12729 } 12730 12731 static __inline__ vector unsigned int __ATTRS_o_ai 12732 vec_unpackl(vector pixel __a) { 12733 #ifdef __LITTLE_ENDIAN__ 12734 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12735 #else 12736 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12737 #endif 12738 } 12739 12740 #ifdef __POWER8_VECTOR__ 12741 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 12742 #ifdef __LITTLE_ENDIAN__ 12743 return __builtin_altivec_vupkhsw(__a); 12744 #else 12745 return __builtin_altivec_vupklsw(__a); 12746 #endif 12747 } 12748 12749 static __inline__ vector bool long long __ATTRS_o_ai 12750 vec_unpackl(vector bool int __a) { 12751 #ifdef __LITTLE_ENDIAN__ 12752 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12753 #else 12754 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12755 #endif 12756 } 12757 12758 static __inline__ vector double __ATTRS_o_ai 12759 vec_unpackl(vector float __a) { 12760 return (vector double)(__a[2], __a[3]); 12761 } 12762 #endif 12763 12764 /* vec_vupklsb */ 12765 12766 static __inline__ vector short __ATTRS_o_ai 12767 vec_vupklsb(vector signed char __a) { 12768 #ifdef __LITTLE_ENDIAN__ 12769 return __builtin_altivec_vupkhsb((vector char)__a); 12770 #else 12771 return __builtin_altivec_vupklsb((vector char)__a); 12772 #endif 12773 } 12774 12775 static __inline__ vector bool short __ATTRS_o_ai 12776 vec_vupklsb(vector bool char __a) { 12777 #ifdef __LITTLE_ENDIAN__ 12778 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12779 #else 12780 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12781 #endif 12782 } 12783 12784 /* vec_vupklsh */ 12785 12786 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 12787 #ifdef __LITTLE_ENDIAN__ 12788 return __builtin_altivec_vupkhsh(__a); 12789 #else 12790 return __builtin_altivec_vupklsh(__a); 12791 #endif 12792 } 12793 12794 static __inline__ vector bool int __ATTRS_o_ai 12795 vec_vupklsh(vector bool short __a) { 12796 #ifdef __LITTLE_ENDIAN__ 12797 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12798 #else 12799 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12800 #endif 12801 } 12802 12803 static __inline__ vector unsigned int __ATTRS_o_ai 12804 vec_vupklsh(vector pixel __a) { 12805 #ifdef __LITTLE_ENDIAN__ 12806 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12807 #else 12808 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12809 #endif 12810 } 12811 12812 /* vec_vupklsw */ 12813 12814 #ifdef __POWER8_VECTOR__ 12815 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 12816 #ifdef __LITTLE_ENDIAN__ 12817 return __builtin_altivec_vupkhsw(__a); 12818 #else 12819 return __builtin_altivec_vupklsw(__a); 12820 #endif 12821 } 12822 12823 static __inline__ vector bool long long __ATTRS_o_ai 12824 vec_vupklsw(vector bool int __a) { 12825 #ifdef __LITTLE_ENDIAN__ 12826 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12827 #else 12828 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12829 #endif 12830 } 12831 #endif 12832 12833 /* vec_vsx_ld */ 12834 12835 #ifdef __VSX__ 12836 12837 static __inline__ vector bool int __ATTRS_o_ai 12838 vec_vsx_ld(int __a, const vector bool int *__b) { 12839 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 12840 } 12841 12842 static __inline__ vector signed int __ATTRS_o_ai 12843 vec_vsx_ld(int __a, const vector signed int *__b) { 12844 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12845 } 12846 12847 static __inline__ vector signed int __ATTRS_o_ai 12848 vec_vsx_ld(int __a, const signed int *__b) { 12849 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12850 } 12851 12852 static __inline__ vector unsigned int __ATTRS_o_ai 12853 vec_vsx_ld(int __a, const vector unsigned int *__b) { 12854 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12855 } 12856 12857 static __inline__ vector unsigned int __ATTRS_o_ai 12858 vec_vsx_ld(int __a, const unsigned int *__b) { 12859 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12860 } 12861 12862 static __inline__ vector float __ATTRS_o_ai 12863 vec_vsx_ld(int __a, const vector float *__b) { 12864 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12865 } 12866 12867 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 12868 const float *__b) { 12869 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12870 } 12871 12872 static __inline__ vector signed long long __ATTRS_o_ai 12873 vec_vsx_ld(int __a, const vector signed long long *__b) { 12874 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 12875 } 12876 12877 static __inline__ vector unsigned long long __ATTRS_o_ai 12878 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 12879 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 12880 } 12881 12882 static __inline__ vector double __ATTRS_o_ai 12883 vec_vsx_ld(int __a, const vector double *__b) { 12884 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12885 } 12886 12887 static __inline__ vector double __ATTRS_o_ai 12888 vec_vsx_ld(int __a, const double *__b) { 12889 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12890 } 12891 12892 static __inline__ vector bool short __ATTRS_o_ai 12893 vec_vsx_ld(int __a, const vector bool short *__b) { 12894 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12895 } 12896 12897 static __inline__ vector signed short __ATTRS_o_ai 12898 vec_vsx_ld(int __a, const vector signed short *__b) { 12899 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12900 } 12901 12902 static __inline__ vector signed short __ATTRS_o_ai 12903 vec_vsx_ld(int __a, const signed short *__b) { 12904 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12905 } 12906 12907 static __inline__ vector unsigned short __ATTRS_o_ai 12908 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12909 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12910 } 12911 12912 static __inline__ vector unsigned short __ATTRS_o_ai 12913 vec_vsx_ld(int __a, const unsigned short *__b) { 12914 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12915 } 12916 12917 static __inline__ vector bool char __ATTRS_o_ai 12918 vec_vsx_ld(int __a, const vector bool char *__b) { 12919 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12920 } 12921 12922 static __inline__ vector signed char __ATTRS_o_ai 12923 vec_vsx_ld(int __a, const vector signed char *__b) { 12924 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12925 } 12926 12927 static __inline__ vector signed char __ATTRS_o_ai 12928 vec_vsx_ld(int __a, const signed char *__b) { 12929 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12930 } 12931 12932 static __inline__ vector unsigned char __ATTRS_o_ai 12933 vec_vsx_ld(int __a, const vector unsigned char *__b) { 12934 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12935 } 12936 12937 static __inline__ vector unsigned char __ATTRS_o_ai 12938 vec_vsx_ld(int __a, const unsigned char *__b) { 12939 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12940 } 12941 12942 #endif 12943 12944 /* vec_vsx_st */ 12945 12946 #ifdef __VSX__ 12947 12948 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12949 vector bool int *__c) { 12950 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12951 } 12952 12953 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12954 signed int *__c) { 12955 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12956 } 12957 12958 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12959 unsigned int *__c) { 12960 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12961 } 12962 12963 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12964 vector signed int *__c) { 12965 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12966 } 12967 12968 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed 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 unsigned int __a, int __b, 12974 vector 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 unsigned int __a, int __b, 12979 unsigned int *__c) { 12980 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12981 } 12982 12983 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12984 vector float *__c) { 12985 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12986 } 12987 12988 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12989 float *__c) { 12990 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12991 } 12992 12993 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 12994 int __b, 12995 vector signed long long *__c) { 12996 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12997 } 12998 12999 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 13000 int __b, 13001 vector unsigned long long *__c) { 13002 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13003 } 13004 13005 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 13006 vector double *__c) { 13007 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13008 } 13009 13010 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 13011 double *__c) { 13012 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13013 } 13014 13015 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13016 vector bool short *__c) { 13017 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13018 } 13019 13020 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13021 signed short *__c) { 13022 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13023 } 13024 13025 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13026 unsigned short *__c) { 13027 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13028 } 13029 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13030 vector signed short *__c) { 13031 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13032 } 13033 13034 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13035 signed short *__c) { 13036 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13037 } 13038 13039 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13040 int __b, 13041 vector unsigned short *__c) { 13042 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13043 } 13044 13045 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13046 int __b, unsigned short *__c) { 13047 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13048 } 13049 13050 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13051 vector bool char *__c) { 13052 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13053 } 13054 13055 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13056 signed char *__c) { 13057 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13058 } 13059 13060 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13061 unsigned char *__c) { 13062 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13063 } 13064 13065 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13066 vector signed char *__c) { 13067 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13068 } 13069 13070 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed 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 unsigned char __a, 13076 int __b, 13077 vector unsigned char *__c) { 13078 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13079 } 13080 13081 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13082 int __b, unsigned char *__c) { 13083 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13084 } 13085 13086 #endif 13087 13088 #ifdef __VSX__ 13089 #define vec_xxpermdi __builtin_vsx_xxpermdi 13090 #define vec_xxsldwi __builtin_vsx_xxsldwi 13091 #define vec_permi(__a, __b, __c) \ 13092 _Generic((__a), vector signed long long \ 13093 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13094 (((__c)&0x1) + 2)), \ 13095 vector unsigned long long \ 13096 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13097 (((__c)&0x1) + 2)), \ 13098 vector double \ 13099 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13100 (((__c)&0x1) + 2))) 13101 #endif 13102 13103 /* vec_xor */ 13104 13105 #define __builtin_altivec_vxor vec_xor 13106 13107 static __inline__ vector signed char __ATTRS_o_ai 13108 vec_xor(vector signed char __a, vector signed char __b) { 13109 return __a ^ __b; 13110 } 13111 13112 static __inline__ vector signed char __ATTRS_o_ai 13113 vec_xor(vector bool char __a, vector signed char __b) { 13114 return (vector signed char)__a ^ __b; 13115 } 13116 13117 static __inline__ vector signed char __ATTRS_o_ai 13118 vec_xor(vector signed char __a, vector bool char __b) { 13119 return __a ^ (vector signed char)__b; 13120 } 13121 13122 static __inline__ vector unsigned char __ATTRS_o_ai 13123 vec_xor(vector unsigned char __a, vector unsigned char __b) { 13124 return __a ^ __b; 13125 } 13126 13127 static __inline__ vector unsigned char __ATTRS_o_ai 13128 vec_xor(vector bool char __a, vector unsigned char __b) { 13129 return (vector unsigned char)__a ^ __b; 13130 } 13131 13132 static __inline__ vector unsigned char __ATTRS_o_ai 13133 vec_xor(vector unsigned char __a, vector bool char __b) { 13134 return __a ^ (vector unsigned char)__b; 13135 } 13136 13137 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 13138 vector bool char __b) { 13139 return __a ^ __b; 13140 } 13141 13142 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13143 vector short __b) { 13144 return __a ^ __b; 13145 } 13146 13147 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 13148 vector short __b) { 13149 return (vector short)__a ^ __b; 13150 } 13151 13152 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13153 vector bool short __b) { 13154 return __a ^ (vector short)__b; 13155 } 13156 13157 static __inline__ vector unsigned short __ATTRS_o_ai 13158 vec_xor(vector unsigned short __a, vector unsigned short __b) { 13159 return __a ^ __b; 13160 } 13161 13162 static __inline__ vector unsigned short __ATTRS_o_ai 13163 vec_xor(vector bool short __a, vector unsigned short __b) { 13164 return (vector unsigned short)__a ^ __b; 13165 } 13166 13167 static __inline__ vector unsigned short __ATTRS_o_ai 13168 vec_xor(vector unsigned short __a, vector bool short __b) { 13169 return __a ^ (vector unsigned short)__b; 13170 } 13171 13172 static __inline__ vector bool short __ATTRS_o_ai 13173 vec_xor(vector bool short __a, vector bool short __b) { 13174 return __a ^ __b; 13175 } 13176 13177 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13178 vector int __b) { 13179 return __a ^ __b; 13180 } 13181 13182 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 13183 vector int __b) { 13184 return (vector int)__a ^ __b; 13185 } 13186 13187 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13188 vector bool int __b) { 13189 return __a ^ (vector int)__b; 13190 } 13191 13192 static __inline__ vector unsigned int __ATTRS_o_ai 13193 vec_xor(vector unsigned int __a, vector unsigned int __b) { 13194 return __a ^ __b; 13195 } 13196 13197 static __inline__ vector unsigned int __ATTRS_o_ai 13198 vec_xor(vector bool int __a, vector unsigned int __b) { 13199 return (vector unsigned int)__a ^ __b; 13200 } 13201 13202 static __inline__ vector unsigned int __ATTRS_o_ai 13203 vec_xor(vector unsigned int __a, vector bool int __b) { 13204 return __a ^ (vector unsigned int)__b; 13205 } 13206 13207 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 13208 vector bool int __b) { 13209 return __a ^ __b; 13210 } 13211 13212 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13213 vector float __b) { 13214 vector unsigned int __res = 13215 (vector unsigned int)__a ^ (vector unsigned int)__b; 13216 return (vector float)__res; 13217 } 13218 13219 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 13220 vector float __b) { 13221 vector unsigned int __res = 13222 (vector unsigned int)__a ^ (vector unsigned int)__b; 13223 return (vector float)__res; 13224 } 13225 13226 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13227 vector bool int __b) { 13228 vector unsigned int __res = 13229 (vector unsigned int)__a ^ (vector unsigned int)__b; 13230 return (vector float)__res; 13231 } 13232 13233 #ifdef __VSX__ 13234 static __inline__ vector signed long long __ATTRS_o_ai 13235 vec_xor(vector signed long long __a, vector signed long long __b) { 13236 return __a ^ __b; 13237 } 13238 13239 static __inline__ vector signed long long __ATTRS_o_ai 13240 vec_xor(vector bool long long __a, vector signed long long __b) { 13241 return (vector signed long long)__a ^ __b; 13242 } 13243 13244 static __inline__ vector signed long long __ATTRS_o_ai 13245 vec_xor(vector signed long long __a, vector bool long long __b) { 13246 return __a ^ (vector signed long long)__b; 13247 } 13248 13249 static __inline__ vector unsigned long long __ATTRS_o_ai 13250 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 13251 return __a ^ __b; 13252 } 13253 13254 static __inline__ vector unsigned long long __ATTRS_o_ai 13255 vec_xor(vector bool long long __a, vector unsigned long long __b) { 13256 return (vector unsigned long long)__a ^ __b; 13257 } 13258 13259 static __inline__ vector unsigned long long __ATTRS_o_ai 13260 vec_xor(vector unsigned long long __a, vector bool long long __b) { 13261 return __a ^ (vector unsigned long long)__b; 13262 } 13263 13264 static __inline__ vector bool long long __ATTRS_o_ai 13265 vec_xor(vector bool long long __a, vector bool long long __b) { 13266 return __a ^ __b; 13267 } 13268 13269 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 13270 vector double __b) { 13271 return (vector double)((vector unsigned long long)__a ^ 13272 (vector unsigned long long)__b); 13273 } 13274 13275 static __inline__ vector double __ATTRS_o_ai 13276 vec_xor(vector double __a, vector bool long long __b) { 13277 return (vector double)((vector unsigned long long)__a ^ 13278 (vector unsigned long long)__b); 13279 } 13280 13281 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 13282 vector double __b) { 13283 return (vector double)((vector unsigned long long)__a ^ 13284 (vector unsigned long long)__b); 13285 } 13286 #endif 13287 13288 /* vec_vxor */ 13289 13290 static __inline__ vector signed char __ATTRS_o_ai 13291 vec_vxor(vector signed char __a, vector signed char __b) { 13292 return __a ^ __b; 13293 } 13294 13295 static __inline__ vector signed char __ATTRS_o_ai 13296 vec_vxor(vector bool char __a, vector signed char __b) { 13297 return (vector signed char)__a ^ __b; 13298 } 13299 13300 static __inline__ vector signed char __ATTRS_o_ai 13301 vec_vxor(vector signed char __a, vector bool char __b) { 13302 return __a ^ (vector signed char)__b; 13303 } 13304 13305 static __inline__ vector unsigned char __ATTRS_o_ai 13306 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 13307 return __a ^ __b; 13308 } 13309 13310 static __inline__ vector unsigned char __ATTRS_o_ai 13311 vec_vxor(vector bool char __a, vector unsigned char __b) { 13312 return (vector unsigned char)__a ^ __b; 13313 } 13314 13315 static __inline__ vector unsigned char __ATTRS_o_ai 13316 vec_vxor(vector unsigned char __a, vector bool char __b) { 13317 return __a ^ (vector unsigned char)__b; 13318 } 13319 13320 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 13321 vector bool char __b) { 13322 return __a ^ __b; 13323 } 13324 13325 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13326 vector short __b) { 13327 return __a ^ __b; 13328 } 13329 13330 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 13331 vector short __b) { 13332 return (vector short)__a ^ __b; 13333 } 13334 13335 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13336 vector bool short __b) { 13337 return __a ^ (vector short)__b; 13338 } 13339 13340 static __inline__ vector unsigned short __ATTRS_o_ai 13341 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 13342 return __a ^ __b; 13343 } 13344 13345 static __inline__ vector unsigned short __ATTRS_o_ai 13346 vec_vxor(vector bool short __a, vector unsigned short __b) { 13347 return (vector unsigned short)__a ^ __b; 13348 } 13349 13350 static __inline__ vector unsigned short __ATTRS_o_ai 13351 vec_vxor(vector unsigned short __a, vector bool short __b) { 13352 return __a ^ (vector unsigned short)__b; 13353 } 13354 13355 static __inline__ vector bool short __ATTRS_o_ai 13356 vec_vxor(vector bool short __a, vector bool short __b) { 13357 return __a ^ __b; 13358 } 13359 13360 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13361 vector int __b) { 13362 return __a ^ __b; 13363 } 13364 13365 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 13366 vector int __b) { 13367 return (vector int)__a ^ __b; 13368 } 13369 13370 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13371 vector bool int __b) { 13372 return __a ^ (vector int)__b; 13373 } 13374 13375 static __inline__ vector unsigned int __ATTRS_o_ai 13376 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 13377 return __a ^ __b; 13378 } 13379 13380 static __inline__ vector unsigned int __ATTRS_o_ai 13381 vec_vxor(vector bool int __a, vector unsigned int __b) { 13382 return (vector unsigned int)__a ^ __b; 13383 } 13384 13385 static __inline__ vector unsigned int __ATTRS_o_ai 13386 vec_vxor(vector unsigned int __a, vector bool int __b) { 13387 return __a ^ (vector unsigned int)__b; 13388 } 13389 13390 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 13391 vector bool int __b) { 13392 return __a ^ __b; 13393 } 13394 13395 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13396 vector float __b) { 13397 vector unsigned int __res = 13398 (vector unsigned int)__a ^ (vector unsigned int)__b; 13399 return (vector float)__res; 13400 } 13401 13402 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 13403 vector float __b) { 13404 vector unsigned int __res = 13405 (vector unsigned int)__a ^ (vector unsigned int)__b; 13406 return (vector float)__res; 13407 } 13408 13409 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13410 vector bool int __b) { 13411 vector unsigned int __res = 13412 (vector unsigned int)__a ^ (vector unsigned int)__b; 13413 return (vector float)__res; 13414 } 13415 13416 #ifdef __VSX__ 13417 static __inline__ vector signed long long __ATTRS_o_ai 13418 vec_vxor(vector signed long long __a, vector signed long long __b) { 13419 return __a ^ __b; 13420 } 13421 13422 static __inline__ vector signed long long __ATTRS_o_ai 13423 vec_vxor(vector bool long long __a, vector signed long long __b) { 13424 return (vector signed long long)__a ^ __b; 13425 } 13426 13427 static __inline__ vector signed long long __ATTRS_o_ai 13428 vec_vxor(vector signed long long __a, vector bool long long __b) { 13429 return __a ^ (vector signed long long)__b; 13430 } 13431 13432 static __inline__ vector unsigned long long __ATTRS_o_ai 13433 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 13434 return __a ^ __b; 13435 } 13436 13437 static __inline__ vector unsigned long long __ATTRS_o_ai 13438 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 13439 return (vector unsigned long long)__a ^ __b; 13440 } 13441 13442 static __inline__ vector unsigned long long __ATTRS_o_ai 13443 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 13444 return __a ^ (vector unsigned long long)__b; 13445 } 13446 13447 static __inline__ vector bool long long __ATTRS_o_ai 13448 vec_vxor(vector bool long long __a, vector bool long long __b) { 13449 return __a ^ __b; 13450 } 13451 #endif 13452 13453 /* ------------------------ extensions for CBEA ----------------------------- */ 13454 13455 /* vec_extract */ 13456 13457 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 13458 signed int __b) { 13459 return __a[__b & 0xf]; 13460 } 13461 13462 static __inline__ unsigned char __ATTRS_o_ai 13463 vec_extract(vector unsigned char __a, signed int __b) { 13464 return __a[__b & 0xf]; 13465 } 13466 13467 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 13468 signed int __b) { 13469 return __a[__b & 0xf]; 13470 } 13471 13472 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 13473 signed int __b) { 13474 return __a[__b & 0x7]; 13475 } 13476 13477 static __inline__ unsigned short __ATTRS_o_ai 13478 vec_extract(vector unsigned short __a, signed int __b) { 13479 return __a[__b & 0x7]; 13480 } 13481 13482 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 13483 signed int __b) { 13484 return __a[__b & 0x7]; 13485 } 13486 13487 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 13488 signed int __b) { 13489 return __a[__b & 0x3]; 13490 } 13491 13492 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 13493 signed int __b) { 13494 return __a[__b & 0x3]; 13495 } 13496 13497 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 13498 signed int __b) { 13499 return __a[__b & 0x3]; 13500 } 13501 13502 #ifdef __VSX__ 13503 static __inline__ signed long long __ATTRS_o_ai 13504 vec_extract(vector signed long long __a, signed int __b) { 13505 return __a[__b & 0x1]; 13506 } 13507 13508 static __inline__ unsigned long long __ATTRS_o_ai 13509 vec_extract(vector unsigned long long __a, signed int __b) { 13510 return __a[__b & 0x1]; 13511 } 13512 13513 static __inline__ unsigned long long __ATTRS_o_ai 13514 vec_extract(vector bool long long __a, signed int __b) { 13515 return __a[__b & 0x1]; 13516 } 13517 13518 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, 13519 signed int __b) { 13520 return __a[__b & 0x1]; 13521 } 13522 #endif 13523 13524 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, 13525 signed int __b) { 13526 return __a[__b & 0x3]; 13527 } 13528 13529 #ifdef __POWER9_VECTOR__ 13530 13531 #define vec_insert4b __builtin_vsx_insertword 13532 #define vec_extract4b __builtin_vsx_extractuword 13533 13534 /* vec_extract_exp */ 13535 13536 static __inline__ vector unsigned int __ATTRS_o_ai 13537 vec_extract_exp(vector float __a) { 13538 return __builtin_vsx_xvxexpsp(__a); 13539 } 13540 13541 static __inline__ vector unsigned long long __ATTRS_o_ai 13542 vec_extract_exp(vector double __a) { 13543 return __builtin_vsx_xvxexpdp(__a); 13544 } 13545 13546 /* vec_extract_sig */ 13547 13548 static __inline__ vector unsigned int __ATTRS_o_ai 13549 vec_extract_sig(vector float __a) { 13550 return __builtin_vsx_xvxsigsp(__a); 13551 } 13552 13553 static __inline__ vector unsigned long long __ATTRS_o_ai 13554 vec_extract_sig (vector double __a) { 13555 return __builtin_vsx_xvxsigdp(__a); 13556 } 13557 13558 static __inline__ vector float __ATTRS_o_ai 13559 vec_extract_fp32_from_shorth(vector unsigned short __a) { 13560 vector unsigned short __b = 13561 #ifdef __LITTLE_ENDIAN__ 13562 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 13563 #else 13564 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 13565 #endif 13566 return __builtin_vsx_xvcvhpsp(__b); 13567 } 13568 13569 static __inline__ vector float __ATTRS_o_ai 13570 vec_extract_fp32_from_shortl(vector unsigned short __a) { 13571 vector unsigned short __b = 13572 #ifdef __LITTLE_ENDIAN__ 13573 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 13574 #else 13575 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 13576 #endif 13577 return __builtin_vsx_xvcvhpsp(__b); 13578 } 13579 #endif /* __POWER9_VECTOR__ */ 13580 13581 /* vec_insert */ 13582 13583 static __inline__ vector signed char __ATTRS_o_ai 13584 vec_insert(signed char __a, vector signed char __b, int __c) { 13585 __b[__c & 0xF] = __a; 13586 return __b; 13587 } 13588 13589 static __inline__ vector unsigned char __ATTRS_o_ai 13590 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 13591 __b[__c & 0xF] = __a; 13592 return __b; 13593 } 13594 13595 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 13596 vector bool char __b, 13597 int __c) { 13598 __b[__c & 0xF] = __a; 13599 return __b; 13600 } 13601 13602 static __inline__ vector signed short __ATTRS_o_ai 13603 vec_insert(signed short __a, vector signed short __b, int __c) { 13604 __b[__c & 0x7] = __a; 13605 return __b; 13606 } 13607 13608 static __inline__ vector unsigned short __ATTRS_o_ai 13609 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 13610 __b[__c & 0x7] = __a; 13611 return __b; 13612 } 13613 13614 static __inline__ vector bool short __ATTRS_o_ai 13615 vec_insert(unsigned short __a, vector bool short __b, int __c) { 13616 __b[__c & 0x7] = __a; 13617 return __b; 13618 } 13619 13620 static __inline__ vector signed int __ATTRS_o_ai 13621 vec_insert(signed int __a, vector signed int __b, int __c) { 13622 __b[__c & 0x3] = __a; 13623 return __b; 13624 } 13625 13626 static __inline__ vector unsigned int __ATTRS_o_ai 13627 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 13628 __b[__c & 0x3] = __a; 13629 return __b; 13630 } 13631 13632 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 13633 vector bool int __b, 13634 int __c) { 13635 __b[__c & 0x3] = __a; 13636 return __b; 13637 } 13638 13639 #ifdef __VSX__ 13640 static __inline__ vector signed long long __ATTRS_o_ai 13641 vec_insert(signed long long __a, vector signed long long __b, int __c) { 13642 __b[__c & 0x1] = __a; 13643 return __b; 13644 } 13645 13646 static __inline__ vector unsigned long long __ATTRS_o_ai 13647 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 13648 __b[__c & 0x1] = __a; 13649 return __b; 13650 } 13651 13652 static __inline__ vector bool long long __ATTRS_o_ai 13653 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 13654 __b[__c & 0x1] = __a; 13655 return __b; 13656 } 13657 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 13658 vector double __b, 13659 int __c) { 13660 __b[__c & 0x1] = __a; 13661 return __b; 13662 } 13663 #endif 13664 13665 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 13666 vector float __b, 13667 int __c) { 13668 __b[__c & 0x3] = __a; 13669 return __b; 13670 } 13671 13672 /* vec_lvlx */ 13673 13674 static __inline__ vector signed char __ATTRS_o_ai 13675 vec_lvlx(int __a, const signed char *__b) { 13676 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13677 vec_lvsl(__a, __b)); 13678 } 13679 13680 static __inline__ vector signed char __ATTRS_o_ai 13681 vec_lvlx(int __a, const vector signed char *__b) { 13682 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13683 vec_lvsl(__a, (unsigned char *)__b)); 13684 } 13685 13686 static __inline__ vector unsigned char __ATTRS_o_ai 13687 vec_lvlx(int __a, const unsigned char *__b) { 13688 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13689 vec_lvsl(__a, __b)); 13690 } 13691 13692 static __inline__ vector unsigned char __ATTRS_o_ai 13693 vec_lvlx(int __a, const vector unsigned char *__b) { 13694 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13695 vec_lvsl(__a, (unsigned char *)__b)); 13696 } 13697 13698 static __inline__ vector bool char __ATTRS_o_ai 13699 vec_lvlx(int __a, const vector bool char *__b) { 13700 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 13701 vec_lvsl(__a, (unsigned char *)__b)); 13702 } 13703 13704 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13705 const short *__b) { 13706 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13707 } 13708 13709 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13710 const vector short *__b) { 13711 return vec_perm(vec_ld(__a, __b), (vector short)(0), 13712 vec_lvsl(__a, (unsigned char *)__b)); 13713 } 13714 13715 static __inline__ vector unsigned short __ATTRS_o_ai 13716 vec_lvlx(int __a, const unsigned short *__b) { 13717 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13718 vec_lvsl(__a, __b)); 13719 } 13720 13721 static __inline__ vector unsigned short __ATTRS_o_ai 13722 vec_lvlx(int __a, const vector unsigned short *__b) { 13723 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13724 vec_lvsl(__a, (unsigned char *)__b)); 13725 } 13726 13727 static __inline__ vector bool short __ATTRS_o_ai 13728 vec_lvlx(int __a, const vector bool short *__b) { 13729 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 13730 vec_lvsl(__a, (unsigned char *)__b)); 13731 } 13732 13733 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 13734 const vector pixel *__b) { 13735 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 13736 vec_lvsl(__a, (unsigned char *)__b)); 13737 } 13738 13739 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 13740 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13741 } 13742 13743 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 13744 const vector int *__b) { 13745 return vec_perm(vec_ld(__a, __b), (vector int)(0), 13746 vec_lvsl(__a, (unsigned char *)__b)); 13747 } 13748 13749 static __inline__ vector unsigned int __ATTRS_o_ai 13750 vec_lvlx(int __a, const unsigned int *__b) { 13751 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13752 vec_lvsl(__a, __b)); 13753 } 13754 13755 static __inline__ vector unsigned int __ATTRS_o_ai 13756 vec_lvlx(int __a, const vector unsigned int *__b) { 13757 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13758 vec_lvsl(__a, (unsigned char *)__b)); 13759 } 13760 13761 static __inline__ vector bool int __ATTRS_o_ai 13762 vec_lvlx(int __a, const vector bool int *__b) { 13763 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 13764 vec_lvsl(__a, (unsigned char *)__b)); 13765 } 13766 13767 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13768 const float *__b) { 13769 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13770 } 13771 13772 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13773 const vector float *__b) { 13774 return vec_perm(vec_ld(__a, __b), (vector float)(0), 13775 vec_lvsl(__a, (unsigned char *)__b)); 13776 } 13777 13778 /* vec_lvlxl */ 13779 13780 static __inline__ vector signed char __ATTRS_o_ai 13781 vec_lvlxl(int __a, const signed char *__b) { 13782 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13783 vec_lvsl(__a, __b)); 13784 } 13785 13786 static __inline__ vector signed char __ATTRS_o_ai 13787 vec_lvlxl(int __a, const vector signed char *__b) { 13788 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13789 vec_lvsl(__a, (unsigned char *)__b)); 13790 } 13791 13792 static __inline__ vector unsigned char __ATTRS_o_ai 13793 vec_lvlxl(int __a, const unsigned char *__b) { 13794 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13795 vec_lvsl(__a, __b)); 13796 } 13797 13798 static __inline__ vector unsigned char __ATTRS_o_ai 13799 vec_lvlxl(int __a, const vector unsigned char *__b) { 13800 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13801 vec_lvsl(__a, (unsigned char *)__b)); 13802 } 13803 13804 static __inline__ vector bool char __ATTRS_o_ai 13805 vec_lvlxl(int __a, const vector bool char *__b) { 13806 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 13807 vec_lvsl(__a, (unsigned char *)__b)); 13808 } 13809 13810 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13811 const short *__b) { 13812 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13813 } 13814 13815 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13816 const vector short *__b) { 13817 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 13818 vec_lvsl(__a, (unsigned char *)__b)); 13819 } 13820 13821 static __inline__ vector unsigned short __ATTRS_o_ai 13822 vec_lvlxl(int __a, const unsigned short *__b) { 13823 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13824 vec_lvsl(__a, __b)); 13825 } 13826 13827 static __inline__ vector unsigned short __ATTRS_o_ai 13828 vec_lvlxl(int __a, const vector unsigned short *__b) { 13829 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13830 vec_lvsl(__a, (unsigned char *)__b)); 13831 } 13832 13833 static __inline__ vector bool short __ATTRS_o_ai 13834 vec_lvlxl(int __a, const vector bool short *__b) { 13835 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 13836 vec_lvsl(__a, (unsigned char *)__b)); 13837 } 13838 13839 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 13840 const vector pixel *__b) { 13841 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 13842 vec_lvsl(__a, (unsigned char *)__b)); 13843 } 13844 13845 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 13846 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13847 } 13848 13849 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 13850 const vector int *__b) { 13851 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 13852 vec_lvsl(__a, (unsigned char *)__b)); 13853 } 13854 13855 static __inline__ vector unsigned int __ATTRS_o_ai 13856 vec_lvlxl(int __a, const unsigned int *__b) { 13857 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13858 vec_lvsl(__a, __b)); 13859 } 13860 13861 static __inline__ vector unsigned int __ATTRS_o_ai 13862 vec_lvlxl(int __a, const vector unsigned int *__b) { 13863 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13864 vec_lvsl(__a, (unsigned char *)__b)); 13865 } 13866 13867 static __inline__ vector bool int __ATTRS_o_ai 13868 vec_lvlxl(int __a, const vector bool int *__b) { 13869 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 13870 vec_lvsl(__a, (unsigned char *)__b)); 13871 } 13872 13873 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13874 const float *__b) { 13875 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13876 } 13877 13878 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13879 vector float *__b) { 13880 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 13881 vec_lvsl(__a, (unsigned char *)__b)); 13882 } 13883 13884 /* vec_lvrx */ 13885 13886 static __inline__ vector signed char __ATTRS_o_ai 13887 vec_lvrx(int __a, const signed char *__b) { 13888 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13889 vec_lvsl(__a, __b)); 13890 } 13891 13892 static __inline__ vector signed char __ATTRS_o_ai 13893 vec_lvrx(int __a, const vector signed char *__b) { 13894 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13895 vec_lvsl(__a, (unsigned char *)__b)); 13896 } 13897 13898 static __inline__ vector unsigned char __ATTRS_o_ai 13899 vec_lvrx(int __a, const unsigned char *__b) { 13900 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13901 vec_lvsl(__a, __b)); 13902 } 13903 13904 static __inline__ vector unsigned char __ATTRS_o_ai 13905 vec_lvrx(int __a, const vector unsigned char *__b) { 13906 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13907 vec_lvsl(__a, (unsigned char *)__b)); 13908 } 13909 13910 static __inline__ vector bool char __ATTRS_o_ai 13911 vec_lvrx(int __a, const vector bool char *__b) { 13912 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13913 vec_lvsl(__a, (unsigned char *)__b)); 13914 } 13915 13916 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13917 const short *__b) { 13918 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13919 } 13920 13921 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13922 const vector short *__b) { 13923 return vec_perm((vector short)(0), vec_ld(__a, __b), 13924 vec_lvsl(__a, (unsigned char *)__b)); 13925 } 13926 13927 static __inline__ vector unsigned short __ATTRS_o_ai 13928 vec_lvrx(int __a, const unsigned short *__b) { 13929 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13930 vec_lvsl(__a, __b)); 13931 } 13932 13933 static __inline__ vector unsigned short __ATTRS_o_ai 13934 vec_lvrx(int __a, const vector unsigned short *__b) { 13935 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13936 vec_lvsl(__a, (unsigned char *)__b)); 13937 } 13938 13939 static __inline__ vector bool short __ATTRS_o_ai 13940 vec_lvrx(int __a, const vector bool short *__b) { 13941 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 13942 vec_lvsl(__a, (unsigned char *)__b)); 13943 } 13944 13945 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 13946 const vector pixel *__b) { 13947 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 13948 vec_lvsl(__a, (unsigned char *)__b)); 13949 } 13950 13951 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 13952 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13953 } 13954 13955 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 13956 const vector int *__b) { 13957 return vec_perm((vector int)(0), vec_ld(__a, __b), 13958 vec_lvsl(__a, (unsigned char *)__b)); 13959 } 13960 13961 static __inline__ vector unsigned int __ATTRS_o_ai 13962 vec_lvrx(int __a, const unsigned int *__b) { 13963 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13964 vec_lvsl(__a, __b)); 13965 } 13966 13967 static __inline__ vector unsigned int __ATTRS_o_ai 13968 vec_lvrx(int __a, const vector unsigned int *__b) { 13969 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13970 vec_lvsl(__a, (unsigned char *)__b)); 13971 } 13972 13973 static __inline__ vector bool int __ATTRS_o_ai 13974 vec_lvrx(int __a, const vector bool int *__b) { 13975 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 13976 vec_lvsl(__a, (unsigned char *)__b)); 13977 } 13978 13979 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13980 const float *__b) { 13981 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13982 } 13983 13984 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13985 const vector float *__b) { 13986 return vec_perm((vector float)(0), vec_ld(__a, __b), 13987 vec_lvsl(__a, (unsigned char *)__b)); 13988 } 13989 13990 /* vec_lvrxl */ 13991 13992 static __inline__ vector signed char __ATTRS_o_ai 13993 vec_lvrxl(int __a, const signed char *__b) { 13994 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13995 vec_lvsl(__a, __b)); 13996 } 13997 13998 static __inline__ vector signed char __ATTRS_o_ai 13999 vec_lvrxl(int __a, const vector signed char *__b) { 14000 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 14001 vec_lvsl(__a, (unsigned char *)__b)); 14002 } 14003 14004 static __inline__ vector unsigned char __ATTRS_o_ai 14005 vec_lvrxl(int __a, const unsigned char *__b) { 14006 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 14007 vec_lvsl(__a, __b)); 14008 } 14009 14010 static __inline__ vector unsigned char __ATTRS_o_ai 14011 vec_lvrxl(int __a, const vector unsigned char *__b) { 14012 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 14013 vec_lvsl(__a, (unsigned char *)__b)); 14014 } 14015 14016 static __inline__ vector bool char __ATTRS_o_ai 14017 vec_lvrxl(int __a, const vector bool char *__b) { 14018 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 14019 vec_lvsl(__a, (unsigned char *)__b)); 14020 } 14021 14022 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14023 const short *__b) { 14024 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14025 } 14026 14027 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14028 const vector short *__b) { 14029 return vec_perm((vector short)(0), vec_ldl(__a, __b), 14030 vec_lvsl(__a, (unsigned char *)__b)); 14031 } 14032 14033 static __inline__ vector unsigned short __ATTRS_o_ai 14034 vec_lvrxl(int __a, const unsigned short *__b) { 14035 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14036 vec_lvsl(__a, __b)); 14037 } 14038 14039 static __inline__ vector unsigned short __ATTRS_o_ai 14040 vec_lvrxl(int __a, const vector unsigned short *__b) { 14041 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14042 vec_lvsl(__a, (unsigned char *)__b)); 14043 } 14044 14045 static __inline__ vector bool short __ATTRS_o_ai 14046 vec_lvrxl(int __a, const vector bool short *__b) { 14047 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 14048 vec_lvsl(__a, (unsigned char *)__b)); 14049 } 14050 14051 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 14052 const vector pixel *__b) { 14053 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 14054 vec_lvsl(__a, (unsigned char *)__b)); 14055 } 14056 14057 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 14058 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14059 } 14060 14061 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 14062 const vector int *__b) { 14063 return vec_perm((vector int)(0), vec_ldl(__a, __b), 14064 vec_lvsl(__a, (unsigned char *)__b)); 14065 } 14066 14067 static __inline__ vector unsigned int __ATTRS_o_ai 14068 vec_lvrxl(int __a, const unsigned int *__b) { 14069 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14070 vec_lvsl(__a, __b)); 14071 } 14072 14073 static __inline__ vector unsigned int __ATTRS_o_ai 14074 vec_lvrxl(int __a, const vector unsigned int *__b) { 14075 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14076 vec_lvsl(__a, (unsigned char *)__b)); 14077 } 14078 14079 static __inline__ vector bool int __ATTRS_o_ai 14080 vec_lvrxl(int __a, const vector bool int *__b) { 14081 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 14082 vec_lvsl(__a, (unsigned char *)__b)); 14083 } 14084 14085 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14086 const float *__b) { 14087 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14088 } 14089 14090 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14091 const vector float *__b) { 14092 return vec_perm((vector float)(0), vec_ldl(__a, __b), 14093 vec_lvsl(__a, (unsigned char *)__b)); 14094 } 14095 14096 /* vec_stvlx */ 14097 14098 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14099 signed char *__c) { 14100 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14101 __c); 14102 } 14103 14104 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14105 vector signed char *__c) { 14106 return vec_st( 14107 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14108 __b, __c); 14109 } 14110 14111 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14112 unsigned char *__c) { 14113 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14114 __c); 14115 } 14116 14117 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14118 vector unsigned char *__c) { 14119 return vec_st( 14120 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14121 __b, __c); 14122 } 14123 14124 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 14125 vector bool char *__c) { 14126 return vec_st( 14127 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14128 __b, __c); 14129 } 14130 14131 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14132 short *__c) { 14133 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14134 __c); 14135 } 14136 14137 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14138 vector short *__c) { 14139 return vec_st( 14140 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14141 __b, __c); 14142 } 14143 14144 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14145 int __b, unsigned short *__c) { 14146 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14147 __c); 14148 } 14149 14150 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14151 int __b, 14152 vector unsigned short *__c) { 14153 return vec_st( 14154 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14155 __b, __c); 14156 } 14157 14158 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 14159 vector bool short *__c) { 14160 return vec_st( 14161 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14162 __b, __c); 14163 } 14164 14165 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 14166 vector pixel *__c) { 14167 return vec_st( 14168 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14169 __b, __c); 14170 } 14171 14172 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14173 int *__c) { 14174 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14175 __c); 14176 } 14177 14178 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14179 vector int *__c) { 14180 return vec_st( 14181 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14182 __b, __c); 14183 } 14184 14185 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14186 unsigned int *__c) { 14187 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14188 __c); 14189 } 14190 14191 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14192 vector unsigned int *__c) { 14193 return vec_st( 14194 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14195 __b, __c); 14196 } 14197 14198 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 14199 vector bool int *__c) { 14200 return vec_st( 14201 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14202 __b, __c); 14203 } 14204 14205 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 14206 vector float *__c) { 14207 return vec_st( 14208 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14209 __b, __c); 14210 } 14211 14212 /* vec_stvlxl */ 14213 14214 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14215 signed char *__c) { 14216 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14217 __c); 14218 } 14219 14220 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14221 vector signed char *__c) { 14222 return vec_stl( 14223 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14224 __b, __c); 14225 } 14226 14227 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14228 int __b, unsigned char *__c) { 14229 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14230 __c); 14231 } 14232 14233 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14234 int __b, 14235 vector unsigned char *__c) { 14236 return vec_stl( 14237 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14238 __b, __c); 14239 } 14240 14241 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 14242 vector bool char *__c) { 14243 return vec_stl( 14244 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14245 __b, __c); 14246 } 14247 14248 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14249 short *__c) { 14250 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14251 __c); 14252 } 14253 14254 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14255 vector short *__c) { 14256 return vec_stl( 14257 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14258 __b, __c); 14259 } 14260 14261 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14262 int __b, unsigned short *__c) { 14263 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14264 __c); 14265 } 14266 14267 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14268 int __b, 14269 vector unsigned short *__c) { 14270 return vec_stl( 14271 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14272 __b, __c); 14273 } 14274 14275 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 14276 vector bool short *__c) { 14277 return vec_stl( 14278 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14279 __b, __c); 14280 } 14281 14282 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 14283 vector pixel *__c) { 14284 return vec_stl( 14285 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14286 __b, __c); 14287 } 14288 14289 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14290 int *__c) { 14291 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14292 __c); 14293 } 14294 14295 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14296 vector int *__c) { 14297 return vec_stl( 14298 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14299 __b, __c); 14300 } 14301 14302 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14303 unsigned int *__c) { 14304 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14305 __c); 14306 } 14307 14308 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14309 vector unsigned int *__c) { 14310 return vec_stl( 14311 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14312 __b, __c); 14313 } 14314 14315 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 14316 vector bool int *__c) { 14317 return vec_stl( 14318 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14319 __b, __c); 14320 } 14321 14322 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 14323 vector float *__c) { 14324 return vec_stl( 14325 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14326 __b, __c); 14327 } 14328 14329 /* vec_stvrx */ 14330 14331 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14332 signed char *__c) { 14333 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14334 __c); 14335 } 14336 14337 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14338 vector signed char *__c) { 14339 return vec_st( 14340 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14341 __b, __c); 14342 } 14343 14344 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14345 unsigned char *__c) { 14346 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14347 __c); 14348 } 14349 14350 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14351 vector unsigned char *__c) { 14352 return vec_st( 14353 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14354 __b, __c); 14355 } 14356 14357 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 14358 vector bool char *__c) { 14359 return vec_st( 14360 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14361 __b, __c); 14362 } 14363 14364 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14365 short *__c) { 14366 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14367 __c); 14368 } 14369 14370 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14371 vector short *__c) { 14372 return vec_st( 14373 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14374 __b, __c); 14375 } 14376 14377 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14378 int __b, unsigned short *__c) { 14379 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14380 __c); 14381 } 14382 14383 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14384 int __b, 14385 vector unsigned short *__c) { 14386 return vec_st( 14387 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14388 __b, __c); 14389 } 14390 14391 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 14392 vector bool short *__c) { 14393 return vec_st( 14394 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14395 __b, __c); 14396 } 14397 14398 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 14399 vector pixel *__c) { 14400 return vec_st( 14401 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14402 __b, __c); 14403 } 14404 14405 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14406 int *__c) { 14407 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14408 __c); 14409 } 14410 14411 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14412 vector int *__c) { 14413 return vec_st( 14414 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14415 __b, __c); 14416 } 14417 14418 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14419 unsigned int *__c) { 14420 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14421 __c); 14422 } 14423 14424 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14425 vector unsigned int *__c) { 14426 return vec_st( 14427 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14428 __b, __c); 14429 } 14430 14431 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 14432 vector bool int *__c) { 14433 return vec_st( 14434 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14435 __b, __c); 14436 } 14437 14438 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 14439 vector float *__c) { 14440 return vec_st( 14441 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14442 __b, __c); 14443 } 14444 14445 /* vec_stvrxl */ 14446 14447 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14448 signed char *__c) { 14449 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14450 __c); 14451 } 14452 14453 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14454 vector signed char *__c) { 14455 return vec_stl( 14456 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14457 __b, __c); 14458 } 14459 14460 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14461 int __b, unsigned char *__c) { 14462 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14463 __c); 14464 } 14465 14466 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14467 int __b, 14468 vector unsigned char *__c) { 14469 return vec_stl( 14470 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14471 __b, __c); 14472 } 14473 14474 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 14475 vector bool char *__c) { 14476 return vec_stl( 14477 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14478 __b, __c); 14479 } 14480 14481 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14482 short *__c) { 14483 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14484 __c); 14485 } 14486 14487 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14488 vector short *__c) { 14489 return vec_stl( 14490 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14491 __b, __c); 14492 } 14493 14494 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14495 int __b, unsigned short *__c) { 14496 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14497 __c); 14498 } 14499 14500 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14501 int __b, 14502 vector unsigned short *__c) { 14503 return vec_stl( 14504 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14505 __b, __c); 14506 } 14507 14508 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 14509 vector bool short *__c) { 14510 return vec_stl( 14511 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14512 __b, __c); 14513 } 14514 14515 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 14516 vector pixel *__c) { 14517 return vec_stl( 14518 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14519 __b, __c); 14520 } 14521 14522 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14523 int *__c) { 14524 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14525 __c); 14526 } 14527 14528 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14529 vector int *__c) { 14530 return vec_stl( 14531 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14532 __b, __c); 14533 } 14534 14535 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14536 unsigned int *__c) { 14537 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14538 __c); 14539 } 14540 14541 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14542 vector unsigned int *__c) { 14543 return vec_stl( 14544 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14545 __b, __c); 14546 } 14547 14548 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 14549 vector bool int *__c) { 14550 return vec_stl( 14551 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14552 __b, __c); 14553 } 14554 14555 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 14556 vector float *__c) { 14557 return vec_stl( 14558 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14559 __b, __c); 14560 } 14561 14562 /* vec_promote */ 14563 14564 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 14565 int __b) { 14566 vector signed char __res = (vector signed char)(0); 14567 __res[__b & 0x7] = __a; 14568 return __res; 14569 } 14570 14571 static __inline__ vector unsigned char __ATTRS_o_ai 14572 vec_promote(unsigned char __a, int __b) { 14573 vector unsigned char __res = (vector unsigned char)(0); 14574 __res[__b & 0x7] = __a; 14575 return __res; 14576 } 14577 14578 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 14579 vector short __res = (vector short)(0); 14580 __res[__b & 0x7] = __a; 14581 return __res; 14582 } 14583 14584 static __inline__ vector unsigned short __ATTRS_o_ai 14585 vec_promote(unsigned short __a, int __b) { 14586 vector unsigned short __res = (vector unsigned short)(0); 14587 __res[__b & 0x7] = __a; 14588 return __res; 14589 } 14590 14591 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 14592 vector int __res = (vector int)(0); 14593 __res[__b & 0x3] = __a; 14594 return __res; 14595 } 14596 14597 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 14598 int __b) { 14599 vector unsigned int __res = (vector unsigned int)(0); 14600 __res[__b & 0x3] = __a; 14601 return __res; 14602 } 14603 14604 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 14605 vector float __res = (vector float)(0); 14606 __res[__b & 0x3] = __a; 14607 return __res; 14608 } 14609 14610 #ifdef __VSX__ 14611 static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) { 14612 vector double __res = (vector double)(0); 14613 __res[__b & 0x1] = __a; 14614 return __res; 14615 } 14616 14617 static __inline__ vector signed long long __ATTRS_o_ai 14618 vec_promote(signed long long __a, int __b) { 14619 vector signed long long __res = (vector signed long long)(0); 14620 __res[__b & 0x1] = __a; 14621 return __res; 14622 } 14623 14624 static __inline__ vector unsigned long long __ATTRS_o_ai 14625 vec_promote(unsigned long long __a, int __b) { 14626 vector unsigned long long __res = (vector unsigned long long)(0); 14627 __res[__b & 0x1] = __a; 14628 return __res; 14629 } 14630 #endif 14631 14632 /* vec_splats */ 14633 14634 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 14635 return (vector signed char)(__a); 14636 } 14637 14638 static __inline__ vector unsigned char __ATTRS_o_ai 14639 vec_splats(unsigned char __a) { 14640 return (vector unsigned char)(__a); 14641 } 14642 14643 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 14644 return (vector short)(__a); 14645 } 14646 14647 static __inline__ vector unsigned short __ATTRS_o_ai 14648 vec_splats(unsigned short __a) { 14649 return (vector unsigned short)(__a); 14650 } 14651 14652 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 14653 return (vector int)(__a); 14654 } 14655 14656 static __inline__ vector unsigned int __ATTRS_o_ai 14657 vec_splats(unsigned int __a) { 14658 return (vector unsigned int)(__a); 14659 } 14660 14661 #ifdef __VSX__ 14662 static __inline__ vector signed long long __ATTRS_o_ai 14663 vec_splats(signed long long __a) { 14664 return (vector signed long long)(__a); 14665 } 14666 14667 static __inline__ vector unsigned long long __ATTRS_o_ai 14668 vec_splats(unsigned long long __a) { 14669 return (vector unsigned long long)(__a); 14670 } 14671 14672 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 14673 defined(__SIZEOF_INT128__) 14674 static __inline__ vector signed __int128 __ATTRS_o_ai 14675 vec_splats(signed __int128 __a) { 14676 return (vector signed __int128)(__a); 14677 } 14678 14679 static __inline__ vector unsigned __int128 __ATTRS_o_ai 14680 vec_splats(unsigned __int128 __a) { 14681 return (vector unsigned __int128)(__a); 14682 } 14683 14684 #endif 14685 14686 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 14687 return (vector double)(__a); 14688 } 14689 #endif 14690 14691 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 14692 return (vector float)(__a); 14693 } 14694 14695 /* ----------------------------- predicates --------------------------------- */ 14696 14697 /* vec_all_eq */ 14698 14699 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14700 vector signed char __b) { 14701 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14702 (vector char)__b); 14703 } 14704 14705 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14706 vector bool char __b) { 14707 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14708 (vector char)__b); 14709 } 14710 14711 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14712 vector unsigned char __b) { 14713 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14714 (vector char)__b); 14715 } 14716 14717 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14718 vector bool char __b) { 14719 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14720 (vector char)__b); 14721 } 14722 14723 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14724 vector signed char __b) { 14725 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14726 (vector char)__b); 14727 } 14728 14729 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14730 vector unsigned char __b) { 14731 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14732 (vector char)__b); 14733 } 14734 14735 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14736 vector bool char __b) { 14737 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14738 (vector char)__b); 14739 } 14740 14741 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14742 vector short __b) { 14743 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 14744 } 14745 14746 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14747 vector bool short __b) { 14748 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 14749 } 14750 14751 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14752 vector unsigned short __b) { 14753 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14754 (vector short)__b); 14755 } 14756 14757 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14758 vector bool short __b) { 14759 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14760 (vector short)__b); 14761 } 14762 14763 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14764 vector short __b) { 14765 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14766 (vector short)__b); 14767 } 14768 14769 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14770 vector unsigned short __b) { 14771 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14772 (vector short)__b); 14773 } 14774 14775 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14776 vector bool short __b) { 14777 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14778 (vector short)__b); 14779 } 14780 14781 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 14782 vector pixel __b) { 14783 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14784 (vector short)__b); 14785 } 14786 14787 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 14788 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 14789 } 14790 14791 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 14792 vector bool int __b) { 14793 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 14794 } 14795 14796 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14797 vector unsigned int __b) { 14798 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14799 (vector int)__b); 14800 } 14801 14802 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14803 vector bool int __b) { 14804 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14805 (vector int)__b); 14806 } 14807 14808 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14809 vector int __b) { 14810 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14811 (vector int)__b); 14812 } 14813 14814 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14815 vector unsigned int __b) { 14816 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14817 (vector int)__b); 14818 } 14819 14820 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14821 vector bool int __b) { 14822 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14823 (vector int)__b); 14824 } 14825 14826 #ifdef __VSX__ 14827 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 14828 vector signed long long __b) { 14829 #ifdef __POWER8_VECTOR__ 14830 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 14831 #else 14832 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as 14833 // 32-bit elements. 14834 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0); 14835 #endif 14836 } 14837 14838 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 14839 vector bool long long __b) { 14840 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14841 } 14842 14843 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14844 vector unsigned long long __b) { 14845 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14846 } 14847 14848 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14849 vector bool long long __b) { 14850 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14851 } 14852 14853 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14854 vector 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 bool 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 bool 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 #endif 14868 14869 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 14870 vector float __b) { 14871 #ifdef __VSX__ 14872 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 14873 #else 14874 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 14875 #endif 14876 } 14877 14878 #ifdef __VSX__ 14879 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 14880 vector double __b) { 14881 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 14882 } 14883 #endif 14884 14885 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 14886 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, 14887 vector signed __int128 __b) { 14888 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14889 } 14890 14891 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, 14892 vector unsigned __int128 __b) { 14893 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14894 } 14895 14896 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a, 14897 vector bool __int128 __b) { 14898 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14899 } 14900 #endif 14901 14902 /* vec_all_ge */ 14903 14904 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14905 vector signed char __b) { 14906 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 14907 } 14908 14909 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14910 vector bool char __b) { 14911 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 14912 } 14913 14914 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14915 vector unsigned char __b) { 14916 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 14917 } 14918 14919 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14920 vector bool char __b) { 14921 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 14922 } 14923 14924 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14925 vector signed char __b) { 14926 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a); 14927 } 14928 14929 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14930 vector unsigned char __b) { 14931 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 14932 } 14933 14934 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14935 vector bool char __b) { 14936 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14937 (vector unsigned char)__a); 14938 } 14939 14940 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14941 vector short __b) { 14942 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 14943 } 14944 14945 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14946 vector bool short __b) { 14947 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 14948 } 14949 14950 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14951 vector unsigned short __b) { 14952 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 14953 } 14954 14955 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14956 vector bool short __b) { 14957 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14958 __a); 14959 } 14960 14961 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14962 vector short __b) { 14963 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a); 14964 } 14965 14966 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14967 vector unsigned short __b) { 14968 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 14969 (vector unsigned short)__a); 14970 } 14971 14972 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14973 vector bool short __b) { 14974 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14975 (vector unsigned short)__a); 14976 } 14977 14978 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 14979 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 14980 } 14981 14982 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 14983 vector bool int __b) { 14984 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 14985 } 14986 14987 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14988 vector unsigned int __b) { 14989 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 14990 } 14991 14992 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14993 vector bool int __b) { 14994 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 14995 } 14996 14997 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14998 vector int __b) { 14999 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a); 15000 } 15001 15002 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15003 vector unsigned int __b) { 15004 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 15005 } 15006 15007 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15008 vector bool int __b) { 15009 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 15010 (vector unsigned int)__a); 15011 } 15012 15013 #ifdef __VSX__ 15014 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 15015 vector signed long long __b) { 15016 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 15017 } 15018 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 15019 vector bool long long __b) { 15020 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 15021 __a); 15022 } 15023 15024 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15025 vector unsigned long long __b) { 15026 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 15027 } 15028 15029 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15030 vector bool long long __b) { 15031 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15032 __a); 15033 } 15034 15035 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15036 vector signed long long __b) { 15037 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, 15038 (vector signed long long)__a); 15039 } 15040 15041 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15042 vector unsigned long long __b) { 15043 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 15044 (vector unsigned long long)__a); 15045 } 15046 15047 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15048 vector bool long long __b) { 15049 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15050 (vector unsigned long long)__a); 15051 } 15052 #endif 15053 15054 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 15055 vector float __b) { 15056 #ifdef __VSX__ 15057 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 15058 #else 15059 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 15060 #endif 15061 } 15062 15063 #ifdef __VSX__ 15064 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 15065 vector double __b) { 15066 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 15067 } 15068 #endif 15069 15070 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15071 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, 15072 vector signed __int128 __b) { 15073 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); 15074 } 15075 15076 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, 15077 vector unsigned __int128 __b) { 15078 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); 15079 } 15080 #endif 15081 15082 /* vec_all_gt */ 15083 15084 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15085 vector signed char __b) { 15086 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 15087 } 15088 15089 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15090 vector bool char __b) { 15091 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 15092 } 15093 15094 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15095 vector unsigned char __b) { 15096 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 15097 } 15098 15099 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15100 vector bool char __b) { 15101 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 15102 } 15103 15104 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15105 vector signed char __b) { 15106 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b); 15107 } 15108 15109 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15110 vector unsigned char __b) { 15111 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 15112 } 15113 15114 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15115 vector bool char __b) { 15116 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 15117 (vector unsigned char)__b); 15118 } 15119 15120 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15121 vector short __b) { 15122 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 15123 } 15124 15125 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15126 vector bool short __b) { 15127 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 15128 } 15129 15130 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15131 vector unsigned short __b) { 15132 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 15133 } 15134 15135 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15136 vector bool short __b) { 15137 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 15138 (vector unsigned short)__b); 15139 } 15140 15141 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15142 vector short __b) { 15143 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b); 15144 } 15145 15146 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15147 vector unsigned short __b) { 15148 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15149 __b); 15150 } 15151 15152 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15153 vector bool short __b) { 15154 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15155 (vector unsigned short)__b); 15156 } 15157 15158 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 15159 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 15160 } 15161 15162 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 15163 vector bool int __b) { 15164 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 15165 } 15166 15167 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15168 vector unsigned int __b) { 15169 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 15170 } 15171 15172 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15173 vector bool int __b) { 15174 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 15175 } 15176 15177 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15178 vector int __b) { 15179 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b); 15180 } 15181 15182 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15183 vector unsigned int __b) { 15184 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 15185 } 15186 15187 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15188 vector bool int __b) { 15189 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 15190 (vector unsigned int)__b); 15191 } 15192 15193 #ifdef __VSX__ 15194 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15195 vector signed long long __b) { 15196 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 15197 } 15198 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15199 vector bool long long __b) { 15200 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 15201 (vector signed long long)__b); 15202 } 15203 15204 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15205 vector unsigned long long __b) { 15206 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 15207 } 15208 15209 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15210 vector bool long long __b) { 15211 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 15212 (vector unsigned long long)__b); 15213 } 15214 15215 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15216 vector signed long long __b) { 15217 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a, 15218 __b); 15219 } 15220 15221 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15222 vector unsigned long long __b) { 15223 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15224 __b); 15225 } 15226 15227 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15228 vector bool long long __b) { 15229 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15230 (vector unsigned long long)__b); 15231 } 15232 #endif 15233 15234 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 15235 vector float __b) { 15236 #ifdef __VSX__ 15237 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 15238 #else 15239 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 15240 #endif 15241 } 15242 15243 #ifdef __VSX__ 15244 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 15245 vector double __b) { 15246 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 15247 } 15248 #endif 15249 15250 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15251 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, 15252 vector signed __int128 __b) { 15253 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); 15254 } 15255 15256 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, 15257 vector unsigned __int128 __b) { 15258 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); 15259 } 15260 #endif 15261 15262 /* vec_all_in */ 15263 15264 static __inline__ int __attribute__((__always_inline__)) 15265 vec_all_in(vector float __a, vector float __b) { 15266 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 15267 } 15268 15269 /* vec_all_le */ 15270 15271 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15272 vector signed char __b) { 15273 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 15274 } 15275 15276 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15277 vector bool char __b) { 15278 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 15279 } 15280 15281 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15282 vector unsigned char __b) { 15283 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 15284 } 15285 15286 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15287 vector bool char __b) { 15288 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 15289 } 15290 15291 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15292 vector signed char __b) { 15293 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b); 15294 } 15295 15296 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15297 vector unsigned char __b) { 15298 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 15299 } 15300 15301 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15302 vector bool char __b) { 15303 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 15304 (vector unsigned char)__b); 15305 } 15306 15307 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15308 vector short __b) { 15309 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 15310 } 15311 15312 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15313 vector bool short __b) { 15314 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 15315 } 15316 15317 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15318 vector unsigned short __b) { 15319 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 15320 } 15321 15322 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15323 vector bool short __b) { 15324 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 15325 (vector unsigned short)__b); 15326 } 15327 15328 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15329 vector short __b) { 15330 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b); 15331 } 15332 15333 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15334 vector unsigned short __b) { 15335 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15336 __b); 15337 } 15338 15339 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15340 vector bool short __b) { 15341 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15342 (vector unsigned short)__b); 15343 } 15344 15345 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 15346 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 15347 } 15348 15349 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 15350 vector bool int __b) { 15351 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 15352 } 15353 15354 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15355 vector unsigned int __b) { 15356 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 15357 } 15358 15359 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15360 vector bool int __b) { 15361 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 15362 } 15363 15364 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15365 vector int __b) { 15366 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b); 15367 } 15368 15369 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15370 vector unsigned int __b) { 15371 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 15372 } 15373 15374 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15375 vector bool int __b) { 15376 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 15377 (vector unsigned int)__b); 15378 } 15379 15380 #ifdef __VSX__ 15381 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15382 vector signed long long __b) { 15383 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 15384 } 15385 15386 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15387 vector unsigned long long __b) { 15388 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 15389 } 15390 15391 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15392 vector bool long long __b) { 15393 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 15394 (vector signed long long)__b); 15395 } 15396 15397 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15398 vector bool long long __b) { 15399 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 15400 (vector unsigned long long)__b); 15401 } 15402 15403 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15404 vector signed long long __b) { 15405 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a, 15406 __b); 15407 } 15408 15409 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15410 vector unsigned long long __b) { 15411 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15412 __b); 15413 } 15414 15415 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15416 vector bool long long __b) { 15417 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15418 (vector unsigned long long)__b); 15419 } 15420 #endif 15421 15422 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 15423 vector float __b) { 15424 #ifdef __VSX__ 15425 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 15426 #else 15427 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 15428 #endif 15429 } 15430 15431 #ifdef __VSX__ 15432 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 15433 vector double __b) { 15434 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 15435 } 15436 #endif 15437 15438 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15439 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, 15440 vector signed __int128 __b) { 15441 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); 15442 } 15443 15444 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, 15445 vector unsigned __int128 __b) { 15446 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); 15447 } 15448 #endif 15449 15450 /* vec_all_lt */ 15451 15452 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15453 vector signed char __b) { 15454 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 15455 } 15456 15457 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15458 vector bool char __b) { 15459 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 15460 } 15461 15462 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15463 vector unsigned char __b) { 15464 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 15465 } 15466 15467 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15468 vector bool char __b) { 15469 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 15470 } 15471 15472 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15473 vector signed char __b) { 15474 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a); 15475 } 15476 15477 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15478 vector unsigned char __b) { 15479 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 15480 } 15481 15482 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15483 vector bool char __b) { 15484 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 15485 (vector unsigned char)__a); 15486 } 15487 15488 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15489 vector short __b) { 15490 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 15491 } 15492 15493 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15494 vector bool short __b) { 15495 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 15496 } 15497 15498 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15499 vector unsigned short __b) { 15500 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 15501 } 15502 15503 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15504 vector bool short __b) { 15505 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15506 __a); 15507 } 15508 15509 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15510 vector short __b) { 15511 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a); 15512 } 15513 15514 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15515 vector unsigned short __b) { 15516 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 15517 (vector unsigned short)__a); 15518 } 15519 15520 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15521 vector bool short __b) { 15522 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15523 (vector unsigned short)__a); 15524 } 15525 15526 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 15527 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 15528 } 15529 15530 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 15531 vector bool int __b) { 15532 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 15533 } 15534 15535 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15536 vector unsigned int __b) { 15537 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 15538 } 15539 15540 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15541 vector bool int __b) { 15542 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 15543 } 15544 15545 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15546 vector int __b) { 15547 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a); 15548 } 15549 15550 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15551 vector unsigned int __b) { 15552 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 15553 } 15554 15555 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15556 vector bool int __b) { 15557 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 15558 (vector unsigned int)__a); 15559 } 15560 15561 #ifdef __VSX__ 15562 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15563 vector signed long long __b) { 15564 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 15565 } 15566 15567 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15568 vector unsigned long long __b) { 15569 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 15570 } 15571 15572 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15573 vector bool long long __b) { 15574 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 15575 __a); 15576 } 15577 15578 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15579 vector bool long long __b) { 15580 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15581 __a); 15582 } 15583 15584 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15585 vector signed long long __b) { 15586 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, 15587 (vector signed long long)__a); 15588 } 15589 15590 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15591 vector unsigned long long __b) { 15592 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 15593 (vector unsigned long long)__a); 15594 } 15595 15596 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15597 vector bool long long __b) { 15598 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15599 (vector unsigned long long)__a); 15600 } 15601 #endif 15602 15603 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 15604 vector float __b) { 15605 #ifdef __VSX__ 15606 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 15607 #else 15608 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 15609 #endif 15610 } 15611 15612 #ifdef __VSX__ 15613 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 15614 vector double __b) { 15615 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 15616 } 15617 #endif 15618 15619 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15620 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a, 15621 vector signed __int128 __b) { 15622 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a); 15623 } 15624 15625 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a, 15626 vector unsigned __int128 __b) { 15627 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a); 15628 } 15629 #endif 15630 15631 /* vec_all_nan */ 15632 15633 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 15634 #ifdef __VSX__ 15635 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 15636 #else 15637 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 15638 #endif 15639 } 15640 15641 #ifdef __VSX__ 15642 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 15643 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 15644 } 15645 #endif 15646 15647 /* vec_all_ne */ 15648 15649 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15650 vector signed char __b) { 15651 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15652 (vector char)__b); 15653 } 15654 15655 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15656 vector bool char __b) { 15657 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15658 (vector char)__b); 15659 } 15660 15661 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15662 vector unsigned char __b) { 15663 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15664 (vector char)__b); 15665 } 15666 15667 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15668 vector bool char __b) { 15669 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15670 (vector char)__b); 15671 } 15672 15673 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15674 vector signed char __b) { 15675 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15676 (vector char)__b); 15677 } 15678 15679 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15680 vector unsigned char __b) { 15681 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15682 (vector char)__b); 15683 } 15684 15685 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15686 vector bool char __b) { 15687 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15688 (vector char)__b); 15689 } 15690 15691 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15692 vector short __b) { 15693 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 15694 } 15695 15696 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15697 vector bool short __b) { 15698 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 15699 } 15700 15701 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15702 vector unsigned short __b) { 15703 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15704 (vector short)__b); 15705 } 15706 15707 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15708 vector bool short __b) { 15709 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15710 (vector short)__b); 15711 } 15712 15713 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15714 vector short __b) { 15715 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15716 (vector short)__b); 15717 } 15718 15719 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15720 vector unsigned short __b) { 15721 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15722 (vector short)__b); 15723 } 15724 15725 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15726 vector bool short __b) { 15727 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15728 (vector short)__b); 15729 } 15730 15731 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 15732 vector pixel __b) { 15733 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15734 (vector short)__b); 15735 } 15736 15737 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 15738 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 15739 } 15740 15741 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 15742 vector bool int __b) { 15743 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 15744 } 15745 15746 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15747 vector unsigned int __b) { 15748 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15749 (vector int)__b); 15750 } 15751 15752 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15753 vector bool int __b) { 15754 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15755 (vector int)__b); 15756 } 15757 15758 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15759 vector int __b) { 15760 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15761 (vector int)__b); 15762 } 15763 15764 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15765 vector unsigned int __b) { 15766 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15767 (vector int)__b); 15768 } 15769 15770 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15771 vector bool int __b) { 15772 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15773 (vector int)__b); 15774 } 15775 15776 #ifdef __VSX__ 15777 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15778 vector signed long long __b) { 15779 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 15780 } 15781 15782 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15783 vector unsigned long long __b) { 15784 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 15785 (vector long long)__b); 15786 } 15787 15788 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15789 vector bool long long __b) { 15790 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 15791 (vector signed long long)__b); 15792 } 15793 15794 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15795 vector bool long long __b) { 15796 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15797 (vector signed long long)__b); 15798 } 15799 15800 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15801 vector signed long long __b) { 15802 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15803 (vector signed long long)__b); 15804 } 15805 15806 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15807 vector unsigned long long __b) { 15808 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15809 (vector signed long long)__b); 15810 } 15811 15812 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15813 vector bool long long __b) { 15814 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15815 (vector signed long long)__b); 15816 } 15817 #endif 15818 15819 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 15820 vector float __b) { 15821 #ifdef __VSX__ 15822 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); 15823 #else 15824 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 15825 #endif 15826 } 15827 15828 #ifdef __VSX__ 15829 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 15830 vector double __b) { 15831 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 15832 } 15833 #endif 15834 15835 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15836 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a, 15837 vector signed __int128 __b) { 15838 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15839 } 15840 15841 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a, 15842 vector unsigned __int128 __b) { 15843 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15844 } 15845 15846 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a, 15847 vector bool __int128 __b) { 15848 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15849 } 15850 #endif 15851 15852 /* vec_all_nge */ 15853 15854 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 15855 vector float __b) { 15856 #ifdef __VSX__ 15857 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 15858 #else 15859 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 15860 #endif 15861 } 15862 15863 #ifdef __VSX__ 15864 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 15865 vector double __b) { 15866 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 15867 } 15868 #endif 15869 15870 /* vec_all_ngt */ 15871 15872 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 15873 vector float __b) { 15874 #ifdef __VSX__ 15875 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 15876 #else 15877 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 15878 #endif 15879 } 15880 15881 #ifdef __VSX__ 15882 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 15883 vector double __b) { 15884 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 15885 } 15886 #endif 15887 15888 /* vec_all_nle */ 15889 15890 static __inline__ int __ATTRS_o_ai 15891 vec_all_nle(vector float __a, vector float __b) { 15892 #ifdef __VSX__ 15893 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a); 15894 #else 15895 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 15896 #endif 15897 } 15898 15899 #ifdef __VSX__ 15900 static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a, 15901 vector double __b) { 15902 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a); 15903 } 15904 #endif 15905 15906 /* vec_all_nlt */ 15907 15908 static __inline__ int __ATTRS_o_ai 15909 vec_all_nlt(vector float __a, vector float __b) { 15910 #ifdef __VSX__ 15911 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a); 15912 #else 15913 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 15914 #endif 15915 } 15916 15917 #ifdef __VSX__ 15918 static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a, 15919 vector double __b) { 15920 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a); 15921 } 15922 #endif 15923 15924 /* vec_all_numeric */ 15925 15926 static __inline__ int __ATTRS_o_ai 15927 vec_all_numeric(vector float __a) { 15928 #ifdef __VSX__ 15929 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a); 15930 #else 15931 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 15932 #endif 15933 } 15934 15935 #ifdef __VSX__ 15936 static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) { 15937 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a); 15938 } 15939 #endif 15940 15941 /* vec_any_eq */ 15942 15943 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15944 vector signed char __b) { 15945 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15946 (vector char)__b); 15947 } 15948 15949 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15950 vector bool char __b) { 15951 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15952 (vector char)__b); 15953 } 15954 15955 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15956 vector unsigned char __b) { 15957 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15958 (vector char)__b); 15959 } 15960 15961 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15962 vector bool char __b) { 15963 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15964 (vector char)__b); 15965 } 15966 15967 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15968 vector signed char __b) { 15969 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15970 (vector char)__b); 15971 } 15972 15973 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15974 vector unsigned char __b) { 15975 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15976 (vector char)__b); 15977 } 15978 15979 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15980 vector bool char __b) { 15981 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15982 (vector char)__b); 15983 } 15984 15985 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 15986 vector short __b) { 15987 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 15988 } 15989 15990 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 15991 vector bool short __b) { 15992 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 15993 } 15994 15995 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 15996 vector unsigned short __b) { 15997 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15998 (vector short)__b); 15999 } 16000 16001 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 16002 vector bool short __b) { 16003 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16004 (vector short)__b); 16005 } 16006 16007 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16008 vector short __b) { 16009 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16010 (vector short)__b); 16011 } 16012 16013 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16014 vector unsigned short __b) { 16015 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16016 (vector short)__b); 16017 } 16018 16019 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16020 vector bool short __b) { 16021 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16022 (vector short)__b); 16023 } 16024 16025 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 16026 vector pixel __b) { 16027 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16028 (vector short)__b); 16029 } 16030 16031 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 16032 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 16033 } 16034 16035 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 16036 vector bool int __b) { 16037 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 16038 } 16039 16040 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16041 vector unsigned int __b) { 16042 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16043 (vector int)__b); 16044 } 16045 16046 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16047 vector bool int __b) { 16048 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16049 (vector int)__b); 16050 } 16051 16052 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16053 vector int __b) { 16054 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16055 (vector int)__b); 16056 } 16057 16058 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16059 vector unsigned int __b) { 16060 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16061 (vector int)__b); 16062 } 16063 16064 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16065 vector bool int __b) { 16066 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16067 (vector int)__b); 16068 } 16069 16070 #ifdef __VSX__ 16071 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16072 vector signed long long __b) { 16073 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 16074 } 16075 16076 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16077 vector unsigned long long __b) { 16078 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 16079 (vector long long)__b); 16080 } 16081 16082 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16083 vector bool long long __b) { 16084 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 16085 (vector signed long long)__b); 16086 } 16087 16088 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16089 vector bool long long __b) { 16090 return __builtin_altivec_vcmpequd_p( 16091 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16092 } 16093 16094 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16095 vector signed long long __b) { 16096 return __builtin_altivec_vcmpequd_p( 16097 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16098 } 16099 16100 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16101 vector unsigned long long __b) { 16102 return __builtin_altivec_vcmpequd_p( 16103 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16104 } 16105 16106 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16107 vector bool long long __b) { 16108 return __builtin_altivec_vcmpequd_p( 16109 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16110 } 16111 #endif 16112 16113 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 16114 vector float __b) { 16115 #ifdef __VSX__ 16116 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 16117 #else 16118 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 16119 #endif 16120 } 16121 16122 #ifdef __VSX__ 16123 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 16124 vector double __b) { 16125 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 16126 } 16127 #endif 16128 16129 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16130 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a, 16131 vector signed __int128 __b) { 16132 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16133 } 16134 16135 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a, 16136 vector unsigned __int128 __b) { 16137 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16138 } 16139 16140 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a, 16141 vector bool __int128 __b) { 16142 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16143 } 16144 #endif 16145 16146 /* vec_any_ge */ 16147 16148 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16149 vector signed char __b) { 16150 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 16151 } 16152 16153 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16154 vector bool char __b) { 16155 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 16156 __a); 16157 } 16158 16159 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16160 vector unsigned char __b) { 16161 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 16162 } 16163 16164 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16165 vector bool char __b) { 16166 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16167 __a); 16168 } 16169 16170 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16171 vector signed char __b) { 16172 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, 16173 (vector signed char)__a); 16174 } 16175 16176 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16177 vector unsigned char __b) { 16178 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 16179 (vector unsigned char)__a); 16180 } 16181 16182 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16183 vector bool char __b) { 16184 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16185 (vector unsigned char)__a); 16186 } 16187 16188 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16189 vector short __b) { 16190 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 16191 } 16192 16193 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16194 vector bool short __b) { 16195 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 16196 } 16197 16198 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16199 vector unsigned short __b) { 16200 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 16201 } 16202 16203 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16204 vector bool short __b) { 16205 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16206 __a); 16207 } 16208 16209 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16210 vector short __b) { 16211 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, 16212 (vector signed short)__a); 16213 } 16214 16215 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16216 vector unsigned short __b) { 16217 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 16218 (vector unsigned short)__a); 16219 } 16220 16221 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16222 vector bool short __b) { 16223 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16224 (vector unsigned short)__a); 16225 } 16226 16227 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 16228 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 16229 } 16230 16231 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 16232 vector bool int __b) { 16233 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 16234 } 16235 16236 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16237 vector unsigned int __b) { 16238 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 16239 } 16240 16241 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16242 vector bool int __b) { 16243 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16244 __a); 16245 } 16246 16247 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16248 vector int __b) { 16249 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, 16250 (vector signed int)__a); 16251 } 16252 16253 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16254 vector unsigned int __b) { 16255 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 16256 (vector unsigned int)__a); 16257 } 16258 16259 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16260 vector bool int __b) { 16261 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16262 (vector unsigned int)__a); 16263 } 16264 16265 #ifdef __VSX__ 16266 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16267 vector signed long long __b) { 16268 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 16269 } 16270 16271 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16272 vector unsigned long long __b) { 16273 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 16274 } 16275 16276 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16277 vector bool long long __b) { 16278 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16279 (vector signed long long)__b, __a); 16280 } 16281 16282 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16283 vector bool long long __b) { 16284 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16285 (vector unsigned long long)__b, __a); 16286 } 16287 16288 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16289 vector signed long long __b) { 16290 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, 16291 (vector signed long long)__a); 16292 } 16293 16294 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16295 vector unsigned long long __b) { 16296 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 16297 (vector unsigned long long)__a); 16298 } 16299 16300 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16301 vector bool long long __b) { 16302 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16303 (vector unsigned long long)__b, 16304 (vector unsigned long long)__a); 16305 } 16306 #endif 16307 16308 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 16309 vector float __b) { 16310 #ifdef __VSX__ 16311 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 16312 #else 16313 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 16314 #endif 16315 } 16316 16317 #ifdef __VSX__ 16318 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 16319 vector double __b) { 16320 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 16321 } 16322 #endif 16323 16324 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16325 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, 16326 vector signed __int128 __b) { 16327 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); 16328 } 16329 16330 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, 16331 vector unsigned __int128 __b) { 16332 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); 16333 } 16334 #endif 16335 16336 /* vec_any_gt */ 16337 16338 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16339 vector signed char __b) { 16340 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 16341 } 16342 16343 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16344 vector bool char __b) { 16345 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 16346 (vector signed char)__b); 16347 } 16348 16349 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16350 vector unsigned char __b) { 16351 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 16352 } 16353 16354 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16355 vector bool char __b) { 16356 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 16357 (vector unsigned char)__b); 16358 } 16359 16360 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16361 vector signed char __b) { 16362 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a, 16363 __b); 16364 } 16365 16366 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16367 vector unsigned char __b) { 16368 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16369 __b); 16370 } 16371 16372 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16373 vector bool char __b) { 16374 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16375 (vector unsigned char)__b); 16376 } 16377 16378 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16379 vector short __b) { 16380 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 16381 } 16382 16383 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16384 vector bool short __b) { 16385 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 16386 } 16387 16388 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16389 vector unsigned short __b) { 16390 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 16391 } 16392 16393 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16394 vector bool short __b) { 16395 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 16396 (vector unsigned short)__b); 16397 } 16398 16399 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16400 vector short __b) { 16401 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a, 16402 __b); 16403 } 16404 16405 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16406 vector unsigned short __b) { 16407 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16408 __b); 16409 } 16410 16411 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16412 vector bool short __b) { 16413 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16414 (vector unsigned short)__b); 16415 } 16416 16417 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 16418 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 16419 } 16420 16421 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 16422 vector bool int __b) { 16423 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 16424 } 16425 16426 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16427 vector unsigned int __b) { 16428 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 16429 } 16430 16431 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16432 vector bool int __b) { 16433 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 16434 (vector unsigned int)__b); 16435 } 16436 16437 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16438 vector int __b) { 16439 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a, 16440 __b); 16441 } 16442 16443 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16444 vector unsigned int __b) { 16445 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16446 __b); 16447 } 16448 16449 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16450 vector bool int __b) { 16451 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16452 (vector unsigned int)__b); 16453 } 16454 16455 #ifdef __VSX__ 16456 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16457 vector signed long long __b) { 16458 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 16459 } 16460 16461 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16462 vector unsigned long long __b) { 16463 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 16464 } 16465 16466 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16467 vector bool long long __b) { 16468 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 16469 (vector signed long long)__b); 16470 } 16471 16472 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16473 vector bool long long __b) { 16474 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 16475 (vector unsigned long long)__b); 16476 } 16477 16478 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16479 vector signed long long __b) { 16480 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16481 (vector signed long long)__a, __b); 16482 } 16483 16484 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16485 vector unsigned long long __b) { 16486 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16487 (vector unsigned long long)__a, __b); 16488 } 16489 16490 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16491 vector bool long long __b) { 16492 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16493 (vector unsigned long long)__a, 16494 (vector unsigned long long)__b); 16495 } 16496 #endif 16497 16498 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 16499 vector float __b) { 16500 #ifdef __VSX__ 16501 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 16502 #else 16503 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 16504 #endif 16505 } 16506 16507 #ifdef __VSX__ 16508 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 16509 vector double __b) { 16510 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 16511 } 16512 #endif 16513 16514 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16515 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, 16516 vector signed __int128 __b) { 16517 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); 16518 } 16519 16520 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, 16521 vector unsigned __int128 __b) { 16522 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); 16523 } 16524 #endif 16525 16526 /* vec_any_le */ 16527 16528 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16529 vector signed char __b) { 16530 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 16531 } 16532 16533 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16534 vector bool char __b) { 16535 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 16536 (vector signed char)__b); 16537 } 16538 16539 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16540 vector unsigned char __b) { 16541 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 16542 } 16543 16544 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16545 vector bool char __b) { 16546 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 16547 (vector unsigned char)__b); 16548 } 16549 16550 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16551 vector signed char __b) { 16552 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a, 16553 __b); 16554 } 16555 16556 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16557 vector unsigned char __b) { 16558 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16559 __b); 16560 } 16561 16562 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16563 vector bool char __b) { 16564 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16565 (vector unsigned char)__b); 16566 } 16567 16568 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16569 vector short __b) { 16570 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 16571 } 16572 16573 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16574 vector bool short __b) { 16575 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 16576 } 16577 16578 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16579 vector unsigned short __b) { 16580 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 16581 } 16582 16583 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16584 vector bool short __b) { 16585 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 16586 (vector unsigned short)__b); 16587 } 16588 16589 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16590 vector short __b) { 16591 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a, 16592 __b); 16593 } 16594 16595 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16596 vector unsigned short __b) { 16597 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16598 __b); 16599 } 16600 16601 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16602 vector bool short __b) { 16603 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16604 (vector unsigned short)__b); 16605 } 16606 16607 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 16608 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 16609 } 16610 16611 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 16612 vector bool int __b) { 16613 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 16614 } 16615 16616 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16617 vector unsigned int __b) { 16618 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 16619 } 16620 16621 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16622 vector bool int __b) { 16623 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 16624 (vector unsigned int)__b); 16625 } 16626 16627 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16628 vector int __b) { 16629 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a, 16630 __b); 16631 } 16632 16633 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16634 vector unsigned int __b) { 16635 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16636 __b); 16637 } 16638 16639 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16640 vector bool int __b) { 16641 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16642 (vector unsigned int)__b); 16643 } 16644 16645 #ifdef __VSX__ 16646 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16647 vector signed long long __b) { 16648 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 16649 } 16650 16651 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16652 vector unsigned long long __b) { 16653 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 16654 } 16655 16656 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16657 vector bool long long __b) { 16658 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 16659 (vector signed long long)__b); 16660 } 16661 16662 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16663 vector bool long long __b) { 16664 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 16665 (vector unsigned long long)__b); 16666 } 16667 16668 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16669 vector signed long long __b) { 16670 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16671 (vector signed long long)__a, __b); 16672 } 16673 16674 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16675 vector unsigned long long __b) { 16676 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16677 (vector unsigned long long)__a, __b); 16678 } 16679 16680 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16681 vector bool long long __b) { 16682 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16683 (vector unsigned long long)__a, 16684 (vector unsigned long long)__b); 16685 } 16686 #endif 16687 16688 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 16689 vector float __b) { 16690 #ifdef __VSX__ 16691 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 16692 #else 16693 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 16694 #endif 16695 } 16696 16697 #ifdef __VSX__ 16698 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 16699 vector double __b) { 16700 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 16701 } 16702 #endif 16703 16704 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16705 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, 16706 vector signed __int128 __b) { 16707 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); 16708 } 16709 16710 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, 16711 vector unsigned __int128 __b) { 16712 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); 16713 } 16714 #endif 16715 16716 /* vec_any_lt */ 16717 16718 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16719 vector signed char __b) { 16720 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 16721 } 16722 16723 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16724 vector bool char __b) { 16725 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 16726 __a); 16727 } 16728 16729 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16730 vector unsigned char __b) { 16731 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 16732 } 16733 16734 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16735 vector bool char __b) { 16736 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16737 __a); 16738 } 16739 16740 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16741 vector signed char __b) { 16742 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, 16743 (vector signed char)__a); 16744 } 16745 16746 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16747 vector unsigned char __b) { 16748 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 16749 (vector unsigned char)__a); 16750 } 16751 16752 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16753 vector bool char __b) { 16754 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16755 (vector unsigned char)__a); 16756 } 16757 16758 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16759 vector short __b) { 16760 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 16761 } 16762 16763 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16764 vector bool short __b) { 16765 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 16766 } 16767 16768 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16769 vector unsigned short __b) { 16770 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 16771 } 16772 16773 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16774 vector bool short __b) { 16775 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16776 __a); 16777 } 16778 16779 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16780 vector short __b) { 16781 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, 16782 (vector signed short)__a); 16783 } 16784 16785 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16786 vector unsigned short __b) { 16787 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 16788 (vector unsigned short)__a); 16789 } 16790 16791 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16792 vector bool short __b) { 16793 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16794 (vector unsigned short)__a); 16795 } 16796 16797 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 16798 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 16799 } 16800 16801 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 16802 vector bool int __b) { 16803 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 16804 } 16805 16806 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16807 vector unsigned int __b) { 16808 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 16809 } 16810 16811 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16812 vector bool int __b) { 16813 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16814 __a); 16815 } 16816 16817 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16818 vector int __b) { 16819 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, 16820 (vector signed int)__a); 16821 } 16822 16823 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16824 vector unsigned int __b) { 16825 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 16826 (vector unsigned int)__a); 16827 } 16828 16829 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16830 vector bool int __b) { 16831 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16832 (vector unsigned int)__a); 16833 } 16834 16835 #ifdef __VSX__ 16836 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16837 vector signed long long __b) { 16838 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 16839 } 16840 16841 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16842 vector unsigned long long __b) { 16843 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 16844 } 16845 16846 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16847 vector bool long long __b) { 16848 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16849 (vector signed long long)__b, __a); 16850 } 16851 16852 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16853 vector bool long long __b) { 16854 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16855 (vector unsigned long long)__b, __a); 16856 } 16857 16858 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16859 vector signed long long __b) { 16860 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, 16861 (vector signed long long)__a); 16862 } 16863 16864 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16865 vector unsigned long long __b) { 16866 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 16867 (vector unsigned long long)__a); 16868 } 16869 16870 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16871 vector bool long long __b) { 16872 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16873 (vector unsigned long long)__b, 16874 (vector unsigned long long)__a); 16875 } 16876 #endif 16877 16878 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 16879 vector float __b) { 16880 #ifdef __VSX__ 16881 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 16882 #else 16883 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 16884 #endif 16885 } 16886 16887 #ifdef __VSX__ 16888 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 16889 vector double __b) { 16890 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 16891 } 16892 #endif 16893 16894 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16895 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, 16896 vector signed __int128 __b) { 16897 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); 16898 } 16899 16900 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, 16901 vector unsigned __int128 __b) { 16902 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); 16903 } 16904 #endif 16905 16906 /* vec_any_nan */ 16907 16908 static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) { 16909 #ifdef __VSX__ 16910 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a); 16911 #else 16912 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 16913 #endif 16914 } 16915 #ifdef __VSX__ 16916 static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) { 16917 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a); 16918 } 16919 #endif 16920 16921 /* vec_any_ne */ 16922 16923 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16924 vector signed char __b) { 16925 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16926 (vector char)__b); 16927 } 16928 16929 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16930 vector bool char __b) { 16931 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16932 (vector char)__b); 16933 } 16934 16935 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16936 vector unsigned char __b) { 16937 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16938 (vector char)__b); 16939 } 16940 16941 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16942 vector bool char __b) { 16943 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16944 (vector char)__b); 16945 } 16946 16947 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16948 vector signed char __b) { 16949 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16950 (vector char)__b); 16951 } 16952 16953 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16954 vector unsigned char __b) { 16955 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16956 (vector char)__b); 16957 } 16958 16959 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16960 vector bool char __b) { 16961 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16962 (vector char)__b); 16963 } 16964 16965 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16966 vector short __b) { 16967 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 16968 } 16969 16970 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16971 vector bool short __b) { 16972 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 16973 } 16974 16975 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16976 vector unsigned short __b) { 16977 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16978 (vector short)__b); 16979 } 16980 16981 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16982 vector bool short __b) { 16983 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16984 (vector short)__b); 16985 } 16986 16987 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16988 vector short __b) { 16989 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16990 (vector short)__b); 16991 } 16992 16993 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16994 vector unsigned short __b) { 16995 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16996 (vector short)__b); 16997 } 16998 16999 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17000 vector bool short __b) { 17001 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17002 (vector short)__b); 17003 } 17004 17005 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 17006 vector pixel __b) { 17007 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17008 (vector short)__b); 17009 } 17010 17011 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 17012 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 17013 } 17014 17015 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 17016 vector bool int __b) { 17017 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 17018 } 17019 17020 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17021 vector unsigned int __b) { 17022 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17023 (vector int)__b); 17024 } 17025 17026 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17027 vector bool int __b) { 17028 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17029 (vector int)__b); 17030 } 17031 17032 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17033 vector int __b) { 17034 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17035 (vector int)__b); 17036 } 17037 17038 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17039 vector unsigned int __b) { 17040 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17041 (vector int)__b); 17042 } 17043 17044 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17045 vector bool int __b) { 17046 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17047 (vector int)__b); 17048 } 17049 17050 #ifdef __VSX__ 17051 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17052 vector signed long long __b) { 17053 #ifdef __POWER8_VECTOR__ 17054 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 17055 #else 17056 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is 17057 // not available. 17058 return !vec_all_eq(__a, __b); 17059 #endif 17060 } 17061 17062 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17063 vector unsigned long long __b) { 17064 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17065 } 17066 17067 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17068 vector bool long long __b) { 17069 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17070 } 17071 17072 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17073 vector bool long long __b) { 17074 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17075 } 17076 17077 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17078 vector signed 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 bool long long __a, 17083 vector unsigned 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 bool 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 #endif 17092 17093 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 17094 vector float __b) { 17095 #ifdef __VSX__ 17096 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 17097 #else 17098 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 17099 #endif 17100 } 17101 17102 #ifdef __VSX__ 17103 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 17104 vector double __b) { 17105 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 17106 } 17107 #endif 17108 17109 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 17110 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, 17111 vector signed __int128 __b) { 17112 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17113 } 17114 17115 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, 17116 vector unsigned __int128 __b) { 17117 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17118 } 17119 17120 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a, 17121 vector bool __int128 __b) { 17122 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17123 } 17124 #endif 17125 17126 /* vec_any_nge */ 17127 17128 static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, 17129 vector float __b) { 17130 #ifdef __VSX__ 17131 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b); 17132 #else 17133 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 17134 #endif 17135 } 17136 17137 #ifdef __VSX__ 17138 static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a, 17139 vector double __b) { 17140 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b); 17141 } 17142 #endif 17143 17144 /* vec_any_ngt */ 17145 17146 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, 17147 vector float __b) { 17148 #ifdef __VSX__ 17149 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b); 17150 #else 17151 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 17152 #endif 17153 } 17154 17155 #ifdef __VSX__ 17156 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a, 17157 vector double __b) { 17158 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b); 17159 } 17160 #endif 17161 17162 /* vec_any_nle */ 17163 17164 static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, 17165 vector float __b) { 17166 #ifdef __VSX__ 17167 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a); 17168 #else 17169 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 17170 #endif 17171 } 17172 17173 #ifdef __VSX__ 17174 static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a, 17175 vector double __b) { 17176 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a); 17177 } 17178 #endif 17179 17180 /* vec_any_nlt */ 17181 17182 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, 17183 vector float __b) { 17184 #ifdef __VSX__ 17185 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a); 17186 #else 17187 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 17188 #endif 17189 } 17190 17191 #ifdef __VSX__ 17192 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a, 17193 vector double __b) { 17194 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a); 17195 } 17196 #endif 17197 17198 /* vec_any_numeric */ 17199 17200 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) { 17201 #ifdef __VSX__ 17202 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a); 17203 #else 17204 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 17205 #endif 17206 } 17207 17208 #ifdef __VSX__ 17209 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) { 17210 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a); 17211 } 17212 #endif 17213 17214 /* vec_any_out */ 17215 17216 static __inline__ int __attribute__((__always_inline__)) 17217 vec_any_out(vector float __a, vector float __b) { 17218 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 17219 } 17220 17221 /* Power 8 Crypto functions 17222 Note: We diverge from the current GCC implementation with regard 17223 to cryptography and related functions as follows: 17224 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 17225 - The remaining ones are only available on Power8 and up so 17226 require -mpower8-vector 17227 The justification for this is that export requirements require that 17228 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 17229 support). As a result, we need to be able to turn off support for those. 17230 The remaining ones (currently controlled by -mcrypto for GCC) still 17231 need to be provided on compliant hardware even if Vector.Crypto is not 17232 provided. 17233 */ 17234 #ifdef __CRYPTO__ 17235 #define vec_sbox_be __builtin_altivec_crypto_vsbox 17236 #define vec_cipher_be __builtin_altivec_crypto_vcipher 17237 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 17238 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 17239 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 17240 17241 #ifdef __VSX__ 17242 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17243 __builtin_crypto_vsbox(vector unsigned long long __a) { 17244 return __builtin_altivec_crypto_vsbox(__a); 17245 } 17246 17247 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17248 __builtin_crypto_vcipher(vector unsigned long long __a, 17249 vector unsigned long long __b) { 17250 return __builtin_altivec_crypto_vcipher(__a, __b); 17251 } 17252 17253 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17254 __builtin_crypto_vcipherlast(vector unsigned long long __a, 17255 vector unsigned long long __b) { 17256 return __builtin_altivec_crypto_vcipherlast(__a, __b); 17257 } 17258 17259 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17260 __builtin_crypto_vncipher(vector unsigned long long __a, 17261 vector unsigned long long __b) { 17262 return __builtin_altivec_crypto_vncipher(__a, __b); 17263 } 17264 17265 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17266 __builtin_crypto_vncipherlast(vector unsigned long long __a, 17267 vector unsigned long long __b) { 17268 return __builtin_altivec_crypto_vncipherlast(__a, __b); 17269 } 17270 #endif /* __VSX__ */ 17271 17272 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 17273 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 17274 17275 #define vec_shasigma_be(X, Y, Z) \ 17276 _Generic((X), vector unsigned int \ 17277 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 17278 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 17279 #endif 17280 17281 #ifdef __POWER8_VECTOR__ 17282 static __inline__ vector bool char __ATTRS_o_ai 17283 vec_permxor(vector bool char __a, vector bool char __b, 17284 vector bool char __c) { 17285 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17286 } 17287 17288 static __inline__ vector signed char __ATTRS_o_ai 17289 vec_permxor(vector signed char __a, vector signed char __b, 17290 vector signed char __c) { 17291 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17292 } 17293 17294 static __inline__ vector unsigned char __ATTRS_o_ai 17295 vec_permxor(vector unsigned char __a, vector unsigned char __b, 17296 vector unsigned char __c) { 17297 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17298 } 17299 17300 static __inline__ vector unsigned char __ATTRS_o_ai 17301 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 17302 vector unsigned char __c) { 17303 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17304 } 17305 17306 static __inline__ vector unsigned short __ATTRS_o_ai 17307 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 17308 vector unsigned short __c) { 17309 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 17310 (vector unsigned char)__a, (vector unsigned char)__b, 17311 (vector unsigned char)__c); 17312 } 17313 17314 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 17315 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 17316 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 17317 (vector unsigned char)__a, (vector unsigned char)__b, 17318 (vector unsigned char)__c); 17319 } 17320 17321 static __inline__ vector unsigned long long __ATTRS_o_ai 17322 __builtin_crypto_vpermxor(vector unsigned long long __a, 17323 vector unsigned long long __b, 17324 vector unsigned long long __c) { 17325 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 17326 (vector unsigned char)__a, (vector unsigned char)__b, 17327 (vector unsigned char)__c); 17328 } 17329 17330 static __inline__ vector unsigned char __ATTRS_o_ai 17331 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 17332 return __builtin_altivec_crypto_vpmsumb(__a, __b); 17333 } 17334 17335 static __inline__ vector unsigned short __ATTRS_o_ai 17336 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 17337 return __builtin_altivec_crypto_vpmsumh(__a, __b); 17338 } 17339 17340 static __inline__ vector unsigned int __ATTRS_o_ai 17341 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 17342 return __builtin_altivec_crypto_vpmsumw(__a, __b); 17343 } 17344 17345 static __inline__ vector unsigned long long __ATTRS_o_ai 17346 __builtin_crypto_vpmsumb(vector unsigned long long __a, 17347 vector unsigned long long __b) { 17348 return __builtin_altivec_crypto_vpmsumd(__a, __b); 17349 } 17350 17351 static __inline__ vector signed char __ATTRS_o_ai 17352 vec_vgbbd(vector signed char __a) { 17353 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17354 } 17355 17356 #define vec_pmsum_be __builtin_crypto_vpmsumb 17357 #define vec_gb __builtin_altivec_vgbbd 17358 17359 static __inline__ vector unsigned char __ATTRS_o_ai 17360 vec_vgbbd(vector unsigned char __a) { 17361 return __builtin_altivec_vgbbd(__a); 17362 } 17363 17364 static __inline__ vector signed long long __ATTRS_o_ai 17365 vec_gbb(vector signed long long __a) { 17366 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17367 } 17368 17369 static __inline__ vector unsigned long long __ATTRS_o_ai 17370 vec_gbb(vector unsigned long long __a) { 17371 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17372 } 17373 17374 static __inline__ vector long long __ATTRS_o_ai 17375 vec_vbpermq(vector signed char __a, vector signed char __b) { 17376 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17377 (vector unsigned char)__b); 17378 } 17379 17380 static __inline__ vector long long __ATTRS_o_ai 17381 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 17382 return __builtin_altivec_vbpermq(__a, __b); 17383 } 17384 17385 #if defined(__powerpc64__) && defined(__SIZEOF_INT128__) 17386 static __inline__ vector unsigned long long __ATTRS_o_ai 17387 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 17388 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17389 (vector unsigned char)__b); 17390 } 17391 #endif 17392 static __inline__ vector unsigned char __ATTRS_o_ai 17393 vec_bperm(vector unsigned char __a, vector unsigned char __b) { 17394 return __builtin_altivec_vbpermq(__a, __b); 17395 } 17396 #endif // __POWER8_VECTOR__ 17397 #ifdef __POWER9_VECTOR__ 17398 static __inline__ vector unsigned long long __ATTRS_o_ai 17399 vec_bperm(vector unsigned long long __a, vector unsigned char __b) { 17400 return __builtin_altivec_vbpermd(__a, __b); 17401 } 17402 #endif 17403 17404 17405 /* vec_reve */ 17406 17407 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 17408 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17409 5, 4, 3, 2, 1, 0); 17410 } 17411 17412 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 17413 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17414 5, 4, 3, 2, 1, 0); 17415 } 17416 17417 static inline __ATTRS_o_ai vector unsigned char 17418 vec_reve(vector unsigned char __a) { 17419 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17420 5, 4, 3, 2, 1, 0); 17421 } 17422 17423 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 17424 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17425 } 17426 17427 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 17428 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17429 } 17430 17431 static inline __ATTRS_o_ai vector unsigned int 17432 vec_reve(vector unsigned int __a) { 17433 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17434 } 17435 17436 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 17437 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17438 } 17439 17440 static inline __ATTRS_o_ai vector signed short 17441 vec_reve(vector signed short __a) { 17442 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17443 } 17444 17445 static inline __ATTRS_o_ai vector unsigned short 17446 vec_reve(vector unsigned short __a) { 17447 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17448 } 17449 17450 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 17451 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17452 } 17453 17454 #ifdef __VSX__ 17455 static inline __ATTRS_o_ai vector bool long long 17456 vec_reve(vector bool long long __a) { 17457 return __builtin_shufflevector(__a, __a, 1, 0); 17458 } 17459 17460 static inline __ATTRS_o_ai vector signed long long 17461 vec_reve(vector signed long long __a) { 17462 return __builtin_shufflevector(__a, __a, 1, 0); 17463 } 17464 17465 static inline __ATTRS_o_ai vector unsigned long long 17466 vec_reve(vector unsigned long long __a) { 17467 return __builtin_shufflevector(__a, __a, 1, 0); 17468 } 17469 17470 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 17471 return __builtin_shufflevector(__a, __a, 1, 0); 17472 } 17473 #endif 17474 17475 /* vec_revb */ 17476 static __inline__ vector bool char __ATTRS_o_ai 17477 vec_revb(vector bool char __a) { 17478 return __a; 17479 } 17480 17481 static __inline__ vector signed char __ATTRS_o_ai 17482 vec_revb(vector signed char __a) { 17483 return __a; 17484 } 17485 17486 static __inline__ vector unsigned char __ATTRS_o_ai 17487 vec_revb(vector unsigned char __a) { 17488 return __a; 17489 } 17490 17491 static __inline__ vector bool short __ATTRS_o_ai 17492 vec_revb(vector bool short __a) { 17493 vector unsigned char __indices = 17494 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17495 return vec_perm(__a, __a, __indices); 17496 } 17497 17498 static __inline__ vector signed short __ATTRS_o_ai 17499 vec_revb(vector signed short __a) { 17500 vector unsigned char __indices = 17501 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17502 return vec_perm(__a, __a, __indices); 17503 } 17504 17505 static __inline__ vector unsigned short __ATTRS_o_ai 17506 vec_revb(vector unsigned short __a) { 17507 vector unsigned char __indices = 17508 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17509 return vec_perm(__a, __a, __indices); 17510 } 17511 17512 static __inline__ vector bool int __ATTRS_o_ai 17513 vec_revb(vector bool int __a) { 17514 vector unsigned char __indices = 17515 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17516 return vec_perm(__a, __a, __indices); 17517 } 17518 17519 static __inline__ vector signed int __ATTRS_o_ai 17520 vec_revb(vector signed int __a) { 17521 vector unsigned char __indices = 17522 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17523 return vec_perm(__a, __a, __indices); 17524 } 17525 17526 static __inline__ vector unsigned int __ATTRS_o_ai 17527 vec_revb(vector unsigned int __a) { 17528 vector unsigned char __indices = 17529 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17530 return vec_perm(__a, __a, __indices); 17531 } 17532 17533 static __inline__ vector float __ATTRS_o_ai 17534 vec_revb(vector float __a) { 17535 vector unsigned char __indices = 17536 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17537 return vec_perm(__a, __a, __indices); 17538 } 17539 17540 #ifdef __VSX__ 17541 static __inline__ vector bool long long __ATTRS_o_ai 17542 vec_revb(vector bool long long __a) { 17543 vector unsigned char __indices = 17544 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17545 return vec_perm(__a, __a, __indices); 17546 } 17547 17548 static __inline__ vector signed long long __ATTRS_o_ai 17549 vec_revb(vector signed long long __a) { 17550 vector unsigned char __indices = 17551 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17552 return vec_perm(__a, __a, __indices); 17553 } 17554 17555 static __inline__ vector unsigned long long __ATTRS_o_ai 17556 vec_revb(vector unsigned long long __a) { 17557 vector unsigned char __indices = 17558 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17559 return vec_perm(__a, __a, __indices); 17560 } 17561 17562 static __inline__ vector double __ATTRS_o_ai 17563 vec_revb(vector double __a) { 17564 vector unsigned char __indices = 17565 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17566 return vec_perm(__a, __a, __indices); 17567 } 17568 #endif /* End __VSX__ */ 17569 17570 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17571 defined(__SIZEOF_INT128__) 17572 static __inline__ vector signed __int128 __ATTRS_o_ai 17573 vec_revb(vector signed __int128 __a) { 17574 vector unsigned char __indices = 17575 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17576 return (vector signed __int128)vec_perm((vector signed int)__a, 17577 (vector signed int)__a, 17578 __indices); 17579 } 17580 17581 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17582 vec_revb(vector unsigned __int128 __a) { 17583 vector unsigned char __indices = 17584 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17585 return (vector unsigned __int128)vec_perm((vector signed int)__a, 17586 (vector signed int)__a, 17587 __indices); 17588 } 17589 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 17590 17591 /* vec_xl */ 17592 17593 #define vec_xld2 vec_xl 17594 #define vec_xlw4 vec_xl 17595 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 17596 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 17597 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 17598 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 17599 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 17600 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 17601 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 17602 17603 static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, 17604 const signed char *__ptr) { 17605 return *(unaligned_vec_schar *)(__ptr + __offset); 17606 } 17607 17608 static inline __ATTRS_o_ai vector unsigned char 17609 vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) { 17610 return *(unaligned_vec_uchar*)(__ptr + __offset); 17611 } 17612 17613 static inline __ATTRS_o_ai vector signed short 17614 vec_xl(ptrdiff_t __offset, const signed short *__ptr) { 17615 signed char *__addr = (signed char *)__ptr + __offset; 17616 return *(unaligned_vec_sshort *)__addr; 17617 } 17618 17619 static inline __ATTRS_o_ai vector unsigned short 17620 vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) { 17621 signed char *__addr = (signed char *)__ptr + __offset; 17622 return *(unaligned_vec_ushort *)__addr; 17623 } 17624 17625 static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset, 17626 const signed int *__ptr) { 17627 signed char *__addr = (signed char *)__ptr + __offset; 17628 return *(unaligned_vec_sint *)__addr; 17629 } 17630 17631 static inline __ATTRS_o_ai vector unsigned int 17632 vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) { 17633 signed char *__addr = (signed char *)__ptr + __offset; 17634 return *(unaligned_vec_uint *)__addr; 17635 } 17636 17637 static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset, 17638 const float *__ptr) { 17639 signed char *__addr = (signed char *)__ptr + __offset; 17640 return *(unaligned_vec_float *)__addr; 17641 } 17642 17643 #ifdef __VSX__ 17644 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 17645 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 17646 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 17647 17648 static inline __ATTRS_o_ai vector signed long long 17649 vec_xl(ptrdiff_t __offset, const signed long long *__ptr) { 17650 signed char *__addr = (signed char *)__ptr + __offset; 17651 return *(unaligned_vec_sll *)__addr; 17652 } 17653 17654 static inline __ATTRS_o_ai vector unsigned long long 17655 vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) { 17656 signed char *__addr = (signed char *)__ptr + __offset; 17657 return *(unaligned_vec_ull *)__addr; 17658 } 17659 17660 static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset, 17661 const double *__ptr) { 17662 signed char *__addr = (signed char *)__ptr + __offset; 17663 return *(unaligned_vec_double *)__addr; 17664 } 17665 #endif 17666 17667 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17668 defined(__SIZEOF_INT128__) 17669 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 17670 typedef vector unsigned __int128 unaligned_vec_ui128 17671 __attribute__((aligned(1))); 17672 static inline __ATTRS_o_ai vector signed __int128 17673 vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) { 17674 signed char *__addr = (signed char *)__ptr + __offset; 17675 return *(unaligned_vec_si128 *)__addr; 17676 } 17677 17678 static inline __ATTRS_o_ai vector unsigned __int128 17679 vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) { 17680 signed char *__addr = (signed char *)__ptr + __offset; 17681 return *(unaligned_vec_ui128 *)__addr; 17682 } 17683 #endif 17684 17685 /* vec_xl_be */ 17686 17687 #ifdef __LITTLE_ENDIAN__ 17688 static __inline__ vector signed char __ATTRS_o_ai 17689 vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) { 17690 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17691 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17692 13, 12, 11, 10, 9, 8); 17693 } 17694 17695 static __inline__ vector unsigned char __ATTRS_o_ai 17696 vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) { 17697 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17698 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17699 13, 12, 11, 10, 9, 8); 17700 } 17701 17702 static __inline__ vector signed short __ATTRS_o_ai 17703 vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) { 17704 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17705 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17706 } 17707 17708 static __inline__ vector unsigned short __ATTRS_o_ai 17709 vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) { 17710 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17711 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17712 } 17713 17714 static __inline__ vector signed int __ATTRS_o_ai 17715 vec_xl_be(signed long long __offset, const signed int *__ptr) { 17716 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17717 } 17718 17719 static __inline__ vector unsigned int __ATTRS_o_ai 17720 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 17721 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17722 } 17723 17724 static __inline__ vector float __ATTRS_o_ai 17725 vec_xl_be(signed long long __offset, const float *__ptr) { 17726 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17727 } 17728 17729 #ifdef __VSX__ 17730 static __inline__ vector signed long long __ATTRS_o_ai 17731 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 17732 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17733 } 17734 17735 static __inline__ vector unsigned long long __ATTRS_o_ai 17736 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 17737 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17738 } 17739 17740 static __inline__ vector double __ATTRS_o_ai 17741 vec_xl_be(signed long long __offset, const double *__ptr) { 17742 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17743 } 17744 #endif 17745 17746 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17747 defined(__SIZEOF_INT128__) 17748 static __inline__ vector signed __int128 __ATTRS_o_ai 17749 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 17750 return vec_xl(__offset, __ptr); 17751 } 17752 17753 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17754 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 17755 return vec_xl(__offset, __ptr); 17756 } 17757 #endif 17758 #else 17759 #define vec_xl_be vec_xl 17760 #endif 17761 17762 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17763 defined(__SIZEOF_INT128__) 17764 17765 /* vect_xl_sext */ 17766 17767 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17768 vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) { 17769 return (vector unsigned __int128)*(__pointer + __offset); 17770 } 17771 17772 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17773 vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) { 17774 return (vector unsigned __int128)*(__pointer + __offset); 17775 } 17776 17777 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17778 vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) { 17779 return (vector unsigned __int128)*(__pointer + __offset); 17780 } 17781 17782 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17783 vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) { 17784 return (vector unsigned __int128)*(__pointer + __offset); 17785 } 17786 17787 /* vec_xl_zext */ 17788 17789 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17790 vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) { 17791 return (vector unsigned __int128)*(__pointer + __offset); 17792 } 17793 17794 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17795 vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) { 17796 return (vector unsigned __int128)*(__pointer + __offset); 17797 } 17798 17799 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17800 vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) { 17801 return (vector unsigned __int128)*(__pointer + __offset); 17802 } 17803 17804 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17805 vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) { 17806 return (vector unsigned __int128)*(__pointer + __offset); 17807 } 17808 17809 #endif 17810 17811 /* vec_xlds */ 17812 #ifdef __VSX__ 17813 static __inline__ vector signed long long __ATTRS_o_ai 17814 vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) { 17815 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset); 17816 return (vector signed long long) *__addr; 17817 } 17818 17819 static __inline__ vector unsigned long long __ATTRS_o_ai 17820 vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) { 17821 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset); 17822 return (unaligned_vec_ull) *__addr; 17823 } 17824 17825 static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset, 17826 const double *__ptr) { 17827 double *__addr = (double*)((signed char *)__ptr + __offset); 17828 return (unaligned_vec_double) *__addr; 17829 } 17830 17831 /* vec_load_splats */ 17832 static __inline__ vector signed int __ATTRS_o_ai 17833 vec_load_splats(signed long long __offset, const signed int *__ptr) { 17834 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17835 return (vector signed int)*__addr; 17836 } 17837 17838 static __inline__ vector signed int __ATTRS_o_ai 17839 vec_load_splats(unsigned long long __offset, const signed int *__ptr) { 17840 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17841 return (vector signed int)*__addr; 17842 } 17843 17844 static __inline__ vector unsigned int __ATTRS_o_ai 17845 vec_load_splats(signed long long __offset, const unsigned int *__ptr) { 17846 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17847 return (vector unsigned int)*__addr; 17848 } 17849 17850 static __inline__ vector unsigned int __ATTRS_o_ai 17851 vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) { 17852 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17853 return (vector unsigned int)*__addr; 17854 } 17855 17856 static __inline__ vector float __ATTRS_o_ai 17857 vec_load_splats(signed long long __offset, const float *__ptr) { 17858 float *__addr = (float*)((signed char *)__ptr + __offset); 17859 return (vector float)*__addr; 17860 } 17861 17862 static __inline__ vector float __ATTRS_o_ai 17863 vec_load_splats(unsigned long long __offset, const float *__ptr) { 17864 float *__addr = (float*)((signed char *)__ptr + __offset); 17865 return (vector float)*__addr; 17866 } 17867 #endif 17868 17869 /* vec_xst */ 17870 17871 #define vec_xstd2 vec_xst 17872 #define vec_xstw4 vec_xst 17873 static inline __ATTRS_o_ai void 17874 vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) { 17875 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 17876 } 17877 17878 static inline __ATTRS_o_ai void 17879 vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) { 17880 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 17881 } 17882 17883 static inline __ATTRS_o_ai void 17884 vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) { 17885 signed char *__addr = (signed char *)__ptr + __offset; 17886 *(unaligned_vec_sshort *)__addr = __vec; 17887 } 17888 17889 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 17890 ptrdiff_t __offset, 17891 unsigned short *__ptr) { 17892 signed char *__addr = (signed char *)__ptr + __offset; 17893 *(unaligned_vec_ushort *)__addr = __vec; 17894 } 17895 17896 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 17897 ptrdiff_t __offset, signed int *__ptr) { 17898 signed char *__addr = (signed char *)__ptr + __offset; 17899 *(unaligned_vec_sint *)__addr = __vec; 17900 } 17901 17902 static inline __ATTRS_o_ai void 17903 vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) { 17904 signed char *__addr = (signed char *)__ptr + __offset; 17905 *(unaligned_vec_uint *)__addr = __vec; 17906 } 17907 17908 static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset, 17909 float *__ptr) { 17910 signed char *__addr = (signed char *)__ptr + __offset; 17911 *(unaligned_vec_float *)__addr = __vec; 17912 } 17913 17914 #ifdef __VSX__ 17915 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 17916 ptrdiff_t __offset, 17917 signed long long *__ptr) { 17918 signed char *__addr = (signed char *)__ptr + __offset; 17919 *(unaligned_vec_sll *)__addr = __vec; 17920 } 17921 17922 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 17923 ptrdiff_t __offset, 17924 unsigned long long *__ptr) { 17925 signed char *__addr = (signed char *)__ptr + __offset; 17926 *(unaligned_vec_ull *)__addr = __vec; 17927 } 17928 17929 static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset, 17930 double *__ptr) { 17931 signed char *__addr = (signed char *)__ptr + __offset; 17932 *(unaligned_vec_double *)__addr = __vec; 17933 } 17934 #endif 17935 17936 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17937 defined(__SIZEOF_INT128__) 17938 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 17939 ptrdiff_t __offset, 17940 signed __int128 *__ptr) { 17941 signed char *__addr = (signed char *)__ptr + __offset; 17942 *(unaligned_vec_si128 *)__addr = __vec; 17943 } 17944 17945 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 17946 ptrdiff_t __offset, 17947 unsigned __int128 *__ptr) { 17948 signed char *__addr = (signed char *)__ptr + __offset; 17949 *(unaligned_vec_ui128 *)__addr = __vec; 17950 } 17951 #endif 17952 17953 /* vec_xst_trunc */ 17954 17955 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17956 defined(__SIZEOF_INT128__) 17957 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17958 ptrdiff_t __offset, 17959 signed char *__ptr) { 17960 *(__ptr + __offset) = (signed char)__vec[0]; 17961 } 17962 17963 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17964 ptrdiff_t __offset, 17965 unsigned char *__ptr) { 17966 *(__ptr + __offset) = (unsigned char)__vec[0]; 17967 } 17968 17969 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17970 ptrdiff_t __offset, 17971 signed short *__ptr) { 17972 *(__ptr + __offset) = (signed short)__vec[0]; 17973 } 17974 17975 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17976 ptrdiff_t __offset, 17977 unsigned short *__ptr) { 17978 *(__ptr + __offset) = (unsigned short)__vec[0]; 17979 } 17980 17981 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17982 ptrdiff_t __offset, 17983 signed int *__ptr) { 17984 *(__ptr + __offset) = (signed int)__vec[0]; 17985 } 17986 17987 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17988 ptrdiff_t __offset, 17989 unsigned int *__ptr) { 17990 *(__ptr + __offset) = (unsigned int)__vec[0]; 17991 } 17992 17993 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17994 ptrdiff_t __offset, 17995 signed long long *__ptr) { 17996 *(__ptr + __offset) = (signed long long)__vec[0]; 17997 } 17998 17999 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18000 ptrdiff_t __offset, 18001 unsigned long long *__ptr) { 18002 *(__ptr + __offset) = (unsigned long long)__vec[0]; 18003 } 18004 #endif 18005 18006 /* vec_xst_be */ 18007 18008 #ifdef __LITTLE_ENDIAN__ 18009 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 18010 signed long long __offset, 18011 signed char *__ptr) { 18012 vector signed char __tmp = 18013 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 18014 13, 12, 11, 10, 9, 8); 18015 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18016 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18017 } 18018 18019 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 18020 signed long long __offset, 18021 unsigned char *__ptr) { 18022 vector unsigned char __tmp = 18023 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 18024 13, 12, 11, 10, 9, 8); 18025 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18026 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18027 } 18028 18029 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 18030 signed long long __offset, 18031 signed short *__ptr) { 18032 vector signed short __tmp = 18033 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18034 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18035 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18036 } 18037 18038 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 18039 signed long long __offset, 18040 unsigned short *__ptr) { 18041 vector unsigned short __tmp = 18042 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18043 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18044 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18045 } 18046 18047 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 18048 signed long long __offset, 18049 signed int *__ptr) { 18050 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 18051 } 18052 18053 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 18054 signed long long __offset, 18055 unsigned int *__ptr) { 18056 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18057 } 18058 18059 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 18060 signed long long __offset, 18061 float *__ptr) { 18062 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18063 } 18064 18065 #ifdef __VSX__ 18066 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 18067 signed long long __offset, 18068 signed long long *__ptr) { 18069 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18070 } 18071 18072 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 18073 signed long long __offset, 18074 unsigned long long *__ptr) { 18075 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18076 } 18077 18078 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 18079 signed long long __offset, 18080 double *__ptr) { 18081 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18082 } 18083 #endif 18084 18085 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 18086 defined(__SIZEOF_INT128__) 18087 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 18088 signed long long __offset, 18089 signed __int128 *__ptr) { 18090 vec_xst(__vec, __offset, __ptr); 18091 } 18092 18093 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 18094 signed long long __offset, 18095 unsigned __int128 *__ptr) { 18096 vec_xst(__vec, __offset, __ptr); 18097 } 18098 #endif 18099 #else 18100 #define vec_xst_be vec_xst 18101 #endif 18102 18103 #ifdef __POWER9_VECTOR__ 18104 #define vec_test_data_class(__a, __b) \ 18105 _Generic( \ 18106 (__a), vector float \ 18107 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 18108 vector double \ 18109 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 18110 (__b))) 18111 18112 #endif /* #ifdef __POWER9_VECTOR__ */ 18113 18114 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 18115 return -__a; 18116 } 18117 18118 #ifdef __VSX__ 18119 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 18120 return -__a; 18121 } 18122 18123 #endif 18124 18125 #ifdef __VSX__ 18126 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 18127 return -__a; 18128 } 18129 #endif 18130 18131 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 18132 return -__a; 18133 } 18134 18135 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 18136 return -__a; 18137 } 18138 18139 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 18140 return -__a; 18141 } 18142 18143 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 18144 return - vec_abs(__a); 18145 } 18146 18147 #ifdef __VSX__ 18148 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 18149 return - vec_abs(__a); 18150 } 18151 18152 #endif 18153 18154 #ifdef __POWER8_VECTOR__ 18155 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 18156 return __builtin_altivec_vminsd(__a, -__a); 18157 } 18158 #endif 18159 18160 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 18161 return __builtin_altivec_vminsw(__a, -__a); 18162 } 18163 18164 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 18165 return __builtin_altivec_vminsh(__a, -__a); 18166 } 18167 18168 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 18169 return __builtin_altivec_vminsb(__a, -__a); 18170 } 18171 18172 static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, 18173 vector float __b) { 18174 return __builtin_ppc_recipdivf(__a, __b); 18175 } 18176 18177 #ifdef __VSX__ 18178 static vector double __ATTRS_o_ai vec_recipdiv(vector double __a, 18179 vector double __b) { 18180 return __builtin_ppc_recipdivd(__a, __b); 18181 } 18182 #endif 18183 18184 #ifdef __POWER10_VECTOR__ 18185 18186 /* vec_extractm */ 18187 18188 static __inline__ unsigned int __ATTRS_o_ai 18189 vec_extractm(vector unsigned char __a) { 18190 return __builtin_altivec_vextractbm(__a); 18191 } 18192 18193 static __inline__ unsigned int __ATTRS_o_ai 18194 vec_extractm(vector unsigned short __a) { 18195 return __builtin_altivec_vextracthm(__a); 18196 } 18197 18198 static __inline__ unsigned int __ATTRS_o_ai 18199 vec_extractm(vector unsigned int __a) { 18200 return __builtin_altivec_vextractwm(__a); 18201 } 18202 18203 static __inline__ unsigned int __ATTRS_o_ai 18204 vec_extractm(vector unsigned long long __a) { 18205 return __builtin_altivec_vextractdm(__a); 18206 } 18207 18208 #ifdef __SIZEOF_INT128__ 18209 static __inline__ unsigned int __ATTRS_o_ai 18210 vec_extractm(vector unsigned __int128 __a) { 18211 return __builtin_altivec_vextractqm(__a); 18212 } 18213 #endif 18214 18215 /* vec_expandm */ 18216 18217 static __inline__ vector unsigned char __ATTRS_o_ai 18218 vec_expandm(vector unsigned char __a) { 18219 return __builtin_altivec_vexpandbm(__a); 18220 } 18221 18222 static __inline__ vector unsigned short __ATTRS_o_ai 18223 vec_expandm(vector unsigned short __a) { 18224 return __builtin_altivec_vexpandhm(__a); 18225 } 18226 18227 static __inline__ vector unsigned int __ATTRS_o_ai 18228 vec_expandm(vector unsigned int __a) { 18229 return __builtin_altivec_vexpandwm(__a); 18230 } 18231 18232 static __inline__ vector unsigned long long __ATTRS_o_ai 18233 vec_expandm(vector unsigned long long __a) { 18234 return __builtin_altivec_vexpanddm(__a); 18235 } 18236 18237 #ifdef __SIZEOF_INT128__ 18238 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18239 vec_expandm(vector unsigned __int128 __a) { 18240 return __builtin_altivec_vexpandqm(__a); 18241 } 18242 #endif 18243 18244 /* vec_cntm */ 18245 18246 #define vec_cntm(__a, __mp) \ 18247 _Generic((__a), vector unsigned char \ 18248 : __builtin_altivec_vcntmbb((__a), (unsigned char)(__mp)), \ 18249 vector unsigned short \ 18250 : __builtin_altivec_vcntmbh((__a), (unsigned char)(__mp)), \ 18251 vector unsigned int \ 18252 : __builtin_altivec_vcntmbw((__a), (unsigned char)(__mp)), \ 18253 vector unsigned long long \ 18254 : __builtin_altivec_vcntmbd((__a), (unsigned char)(__mp))) 18255 18256 /* vec_gen[b|h|w|d|q]m */ 18257 18258 static __inline__ vector unsigned char __ATTRS_o_ai 18259 vec_genbm(unsigned long long __bm) { 18260 return __builtin_altivec_mtvsrbm(__bm); 18261 } 18262 18263 static __inline__ vector unsigned short __ATTRS_o_ai 18264 vec_genhm(unsigned long long __bm) { 18265 return __builtin_altivec_mtvsrhm(__bm); 18266 } 18267 18268 static __inline__ vector unsigned int __ATTRS_o_ai 18269 vec_genwm(unsigned long long __bm) { 18270 return __builtin_altivec_mtvsrwm(__bm); 18271 } 18272 18273 static __inline__ vector unsigned long long __ATTRS_o_ai 18274 vec_gendm(unsigned long long __bm) { 18275 return __builtin_altivec_mtvsrdm(__bm); 18276 } 18277 18278 #ifdef __SIZEOF_INT128__ 18279 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18280 vec_genqm(unsigned long long __bm) { 18281 return __builtin_altivec_mtvsrqm(__bm); 18282 } 18283 #endif 18284 18285 /* vec_pdep */ 18286 18287 static __inline__ vector unsigned long long __ATTRS_o_ai 18288 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 18289 return __builtin_altivec_vpdepd(__a, __b); 18290 } 18291 18292 /* vec_pext */ 18293 18294 static __inline__ vector unsigned long long __ATTRS_o_ai 18295 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 18296 return __builtin_altivec_vpextd(__a, __b); 18297 } 18298 18299 /* vec_cfuge */ 18300 18301 static __inline__ vector unsigned long long __ATTRS_o_ai 18302 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 18303 return __builtin_altivec_vcfuged(__a, __b); 18304 } 18305 18306 /* vec_gnb */ 18307 18308 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 18309 18310 /* vec_ternarylogic */ 18311 #ifdef __VSX__ 18312 #ifdef __SIZEOF_INT128__ 18313 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18314 _Generic((__a), vector unsigned char \ 18315 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18316 (vector unsigned long long)(__b), \ 18317 (vector unsigned long long)(__c), (__imm)), \ 18318 vector unsigned short \ 18319 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18320 (vector unsigned long long)(__b), \ 18321 (vector unsigned long long)(__c), (__imm)), \ 18322 vector unsigned int \ 18323 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18324 (vector unsigned long long)(__b), \ 18325 (vector unsigned long long)(__c), (__imm)), \ 18326 vector unsigned long long \ 18327 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18328 (vector unsigned long long)(__b), \ 18329 (vector unsigned long long)(__c), (__imm)), \ 18330 vector unsigned __int128 \ 18331 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18332 (vector unsigned long long)(__b), \ 18333 (vector unsigned long long)(__c), (__imm))) 18334 #else 18335 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18336 _Generic((__a), vector unsigned char \ 18337 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18338 (vector unsigned long long)(__b), \ 18339 (vector unsigned long long)(__c), (__imm)), \ 18340 vector unsigned short \ 18341 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18342 (vector unsigned long long)(__b), \ 18343 (vector unsigned long long)(__c), (__imm)), \ 18344 vector unsigned int \ 18345 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18346 (vector unsigned long long)(__b), \ 18347 (vector unsigned long long)(__c), (__imm)), \ 18348 vector unsigned long long \ 18349 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18350 (vector unsigned long long)(__b), \ 18351 (vector unsigned long long)(__c), (__imm))) 18352 #endif /* __SIZEOF_INT128__ */ 18353 #endif /* __VSX__ */ 18354 18355 /* vec_genpcvm */ 18356 18357 #ifdef __VSX__ 18358 #define vec_genpcvm(__a, __imm) \ 18359 _Generic((__a), vector unsigned char \ 18360 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ 18361 vector unsigned short \ 18362 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ 18363 vector unsigned int \ 18364 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ 18365 vector unsigned long long \ 18366 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) 18367 #endif /* __VSX__ */ 18368 18369 /* vec_clr_first */ 18370 18371 static __inline__ vector signed char __ATTRS_o_ai 18372 vec_clr_first(vector signed char __a, unsigned int __n) { 18373 #ifdef __LITTLE_ENDIAN__ 18374 return __builtin_altivec_vclrrb(__a, __n); 18375 #else 18376 return __builtin_altivec_vclrlb( __a, __n); 18377 #endif 18378 } 18379 18380 static __inline__ vector unsigned char __ATTRS_o_ai 18381 vec_clr_first(vector unsigned char __a, unsigned int __n) { 18382 #ifdef __LITTLE_ENDIAN__ 18383 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18384 #else 18385 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18386 #endif 18387 } 18388 18389 /* vec_clr_last */ 18390 18391 static __inline__ vector signed char __ATTRS_o_ai 18392 vec_clr_last(vector signed char __a, unsigned int __n) { 18393 #ifdef __LITTLE_ENDIAN__ 18394 return __builtin_altivec_vclrlb(__a, __n); 18395 #else 18396 return __builtin_altivec_vclrrb( __a, __n); 18397 #endif 18398 } 18399 18400 static __inline__ vector unsigned char __ATTRS_o_ai 18401 vec_clr_last(vector unsigned char __a, unsigned int __n) { 18402 #ifdef __LITTLE_ENDIAN__ 18403 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18404 #else 18405 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18406 #endif 18407 } 18408 18409 /* vec_cntlzm */ 18410 18411 static __inline__ vector unsigned long long __ATTRS_o_ai 18412 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 18413 return __builtin_altivec_vclzdm(__a, __b); 18414 } 18415 18416 /* vec_cnttzm */ 18417 18418 static __inline__ vector unsigned long long __ATTRS_o_ai 18419 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 18420 return __builtin_altivec_vctzdm(__a, __b); 18421 } 18422 18423 /* vec_mod */ 18424 18425 static __inline__ vector signed int __ATTRS_o_ai 18426 vec_mod(vector signed int __a, vector signed int __b) { 18427 return __a % __b; 18428 } 18429 18430 static __inline__ vector unsigned int __ATTRS_o_ai 18431 vec_mod(vector unsigned int __a, vector unsigned int __b) { 18432 return __a % __b; 18433 } 18434 18435 static __inline__ vector signed long long __ATTRS_o_ai 18436 vec_mod(vector signed long long __a, vector signed long long __b) { 18437 return __a % __b; 18438 } 18439 18440 static __inline__ vector unsigned long long __ATTRS_o_ai 18441 vec_mod(vector unsigned long long __a, vector unsigned long long __b) { 18442 return __a % __b; 18443 } 18444 18445 #ifdef __SIZEOF_INT128__ 18446 static __inline__ vector signed __int128 __ATTRS_o_ai 18447 vec_mod(vector signed __int128 __a, vector signed __int128 __b) { 18448 return __a % __b; 18449 } 18450 18451 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18452 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18453 return __a % __b; 18454 } 18455 #endif 18456 18457 /* vec_sldbi */ 18458 18459 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) 18460 18461 /* vec_srdbi */ 18462 18463 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) 18464 18465 /* vec_insertl */ 18466 18467 static __inline__ vector unsigned char __ATTRS_o_ai 18468 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18469 #ifdef __LITTLE_ENDIAN__ 18470 return __builtin_altivec_vinsbrx(__b, __c, __a); 18471 #else 18472 return __builtin_altivec_vinsblx(__b, __c, __a); 18473 #endif 18474 } 18475 18476 static __inline__ vector unsigned short __ATTRS_o_ai 18477 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18478 #ifdef __LITTLE_ENDIAN__ 18479 return __builtin_altivec_vinshrx(__b, __c, __a); 18480 #else 18481 return __builtin_altivec_vinshlx(__b, __c, __a); 18482 #endif 18483 } 18484 18485 static __inline__ vector unsigned int __ATTRS_o_ai 18486 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18487 #ifdef __LITTLE_ENDIAN__ 18488 return __builtin_altivec_vinswrx(__b, __c, __a); 18489 #else 18490 return __builtin_altivec_vinswlx(__b, __c, __a); 18491 #endif 18492 } 18493 18494 static __inline__ vector unsigned long long __ATTRS_o_ai 18495 vec_insertl(unsigned long long __a, vector unsigned long long __b, 18496 unsigned int __c) { 18497 #ifdef __LITTLE_ENDIAN__ 18498 return __builtin_altivec_vinsdrx(__b, __c, __a); 18499 #else 18500 return __builtin_altivec_vinsdlx(__b, __c, __a); 18501 #endif 18502 } 18503 18504 static __inline__ vector unsigned char __ATTRS_o_ai 18505 vec_insertl(vector unsigned char __a, vector unsigned char __b, 18506 unsigned int __c) { 18507 #ifdef __LITTLE_ENDIAN__ 18508 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18509 #else 18510 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18511 #endif 18512 } 18513 18514 static __inline__ vector unsigned short __ATTRS_o_ai 18515 vec_insertl(vector unsigned short __a, vector unsigned short __b, 18516 unsigned int __c) { 18517 #ifdef __LITTLE_ENDIAN__ 18518 return __builtin_altivec_vinshvrx(__b, __c, __a); 18519 #else 18520 return __builtin_altivec_vinshvlx(__b, __c, __a); 18521 #endif 18522 } 18523 18524 static __inline__ vector unsigned int __ATTRS_o_ai 18525 vec_insertl(vector unsigned int __a, vector unsigned int __b, 18526 unsigned int __c) { 18527 #ifdef __LITTLE_ENDIAN__ 18528 return __builtin_altivec_vinswvrx(__b, __c, __a); 18529 #else 18530 return __builtin_altivec_vinswvlx(__b, __c, __a); 18531 #endif 18532 } 18533 18534 /* vec_inserth */ 18535 18536 static __inline__ vector unsigned char __ATTRS_o_ai 18537 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18538 #ifdef __LITTLE_ENDIAN__ 18539 return __builtin_altivec_vinsblx(__b, __c, __a); 18540 #else 18541 return __builtin_altivec_vinsbrx(__b, __c, __a); 18542 #endif 18543 } 18544 18545 static __inline__ vector unsigned short __ATTRS_o_ai 18546 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18547 #ifdef __LITTLE_ENDIAN__ 18548 return __builtin_altivec_vinshlx(__b, __c, __a); 18549 #else 18550 return __builtin_altivec_vinshrx(__b, __c, __a); 18551 #endif 18552 } 18553 18554 static __inline__ vector unsigned int __ATTRS_o_ai 18555 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18556 #ifdef __LITTLE_ENDIAN__ 18557 return __builtin_altivec_vinswlx(__b, __c, __a); 18558 #else 18559 return __builtin_altivec_vinswrx(__b, __c, __a); 18560 #endif 18561 } 18562 18563 static __inline__ vector unsigned long long __ATTRS_o_ai 18564 vec_inserth(unsigned long long __a, vector unsigned long long __b, 18565 unsigned int __c) { 18566 #ifdef __LITTLE_ENDIAN__ 18567 return __builtin_altivec_vinsdlx(__b, __c, __a); 18568 #else 18569 return __builtin_altivec_vinsdrx(__b, __c, __a); 18570 #endif 18571 } 18572 18573 static __inline__ vector unsigned char __ATTRS_o_ai 18574 vec_inserth(vector unsigned char __a, vector unsigned char __b, 18575 unsigned int __c) { 18576 #ifdef __LITTLE_ENDIAN__ 18577 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18578 #else 18579 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18580 #endif 18581 } 18582 18583 static __inline__ vector unsigned short __ATTRS_o_ai 18584 vec_inserth(vector unsigned short __a, vector unsigned short __b, 18585 unsigned int __c) { 18586 #ifdef __LITTLE_ENDIAN__ 18587 return __builtin_altivec_vinshvlx(__b, __c, __a); 18588 #else 18589 return __builtin_altivec_vinshvrx(__b, __c, __a); 18590 #endif 18591 } 18592 18593 static __inline__ vector unsigned int __ATTRS_o_ai 18594 vec_inserth(vector unsigned int __a, vector unsigned int __b, 18595 unsigned int __c) { 18596 #ifdef __LITTLE_ENDIAN__ 18597 return __builtin_altivec_vinswvlx(__b, __c, __a); 18598 #else 18599 return __builtin_altivec_vinswvrx(__b, __c, __a); 18600 #endif 18601 } 18602 18603 /* vec_extractl */ 18604 18605 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18606 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18607 #ifdef __LITTLE_ENDIAN__ 18608 return __builtin_altivec_vextdubvrx(__a, __b, __c); 18609 #else 18610 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); 18611 return vec_sld(__ret, __ret, 8); 18612 #endif 18613 } 18614 18615 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18616 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18617 #ifdef __LITTLE_ENDIAN__ 18618 return __builtin_altivec_vextduhvrx(__a, __b, __c); 18619 #else 18620 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); 18621 return vec_sld(__ret, __ret, 8); 18622 #endif 18623 } 18624 18625 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18626 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18627 #ifdef __LITTLE_ENDIAN__ 18628 return __builtin_altivec_vextduwvrx(__a, __b, __c); 18629 #else 18630 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); 18631 return vec_sld(__ret, __ret, 8); 18632 #endif 18633 } 18634 18635 static __inline__ vector unsigned long long __ATTRS_o_ai 18636 vec_extractl(vector unsigned long long __a, vector unsigned long long __b, 18637 unsigned int __c) { 18638 #ifdef __LITTLE_ENDIAN__ 18639 return __builtin_altivec_vextddvrx(__a, __b, __c); 18640 #else 18641 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); 18642 return vec_sld(__ret, __ret, 8); 18643 #endif 18644 } 18645 18646 /* vec_extracth */ 18647 18648 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18649 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18650 #ifdef __LITTLE_ENDIAN__ 18651 return __builtin_altivec_vextdubvlx(__a, __b, __c); 18652 #else 18653 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); 18654 return vec_sld(__ret, __ret, 8); 18655 #endif 18656 } 18657 18658 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18659 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18660 #ifdef __LITTLE_ENDIAN__ 18661 return __builtin_altivec_vextduhvlx(__a, __b, __c); 18662 #else 18663 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); 18664 return vec_sld(__ret, __ret, 8); 18665 #endif 18666 } 18667 18668 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18669 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18670 #ifdef __LITTLE_ENDIAN__ 18671 return __builtin_altivec_vextduwvlx(__a, __b, __c); 18672 #else 18673 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); 18674 return vec_sld(__ret, __ret, 8); 18675 #endif 18676 } 18677 18678 static __inline__ vector unsigned long long __ATTRS_o_ai 18679 vec_extracth(vector unsigned long long __a, vector unsigned long long __b, 18680 unsigned int __c) { 18681 #ifdef __LITTLE_ENDIAN__ 18682 return __builtin_altivec_vextddvlx(__a, __b, __c); 18683 #else 18684 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); 18685 return vec_sld(__ret, __ret, 8); 18686 #endif 18687 } 18688 18689 #ifdef __VSX__ 18690 18691 /* vec_permx */ 18692 18693 #define vec_permx(__a, __b, __c, __d) \ 18694 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) 18695 18696 /* vec_blendv */ 18697 18698 static __inline__ vector signed char __ATTRS_o_ai 18699 vec_blendv(vector signed char __a, vector signed char __b, 18700 vector unsigned char __c) { 18701 return __builtin_vsx_xxblendvb(__a, __b, __c); 18702 } 18703 18704 static __inline__ vector unsigned char __ATTRS_o_ai 18705 vec_blendv(vector unsigned char __a, vector unsigned char __b, 18706 vector unsigned char __c) { 18707 return __builtin_vsx_xxblendvb(__a, __b, __c); 18708 } 18709 18710 static __inline__ vector signed short __ATTRS_o_ai 18711 vec_blendv(vector signed short __a, vector signed short __b, 18712 vector unsigned short __c) { 18713 return __builtin_vsx_xxblendvh(__a, __b, __c); 18714 } 18715 18716 static __inline__ vector unsigned short __ATTRS_o_ai 18717 vec_blendv(vector unsigned short __a, vector unsigned short __b, 18718 vector unsigned short __c) { 18719 return __builtin_vsx_xxblendvh(__a, __b, __c); 18720 } 18721 18722 static __inline__ vector signed int __ATTRS_o_ai 18723 vec_blendv(vector signed int __a, vector signed int __b, 18724 vector unsigned int __c) { 18725 return __builtin_vsx_xxblendvw(__a, __b, __c); 18726 } 18727 18728 static __inline__ vector unsigned int __ATTRS_o_ai 18729 vec_blendv(vector unsigned int __a, vector unsigned int __b, 18730 vector unsigned int __c) { 18731 return __builtin_vsx_xxblendvw(__a, __b, __c); 18732 } 18733 18734 static __inline__ vector signed long long __ATTRS_o_ai 18735 vec_blendv(vector signed long long __a, vector signed long long __b, 18736 vector unsigned long long __c) { 18737 return __builtin_vsx_xxblendvd(__a, __b, __c); 18738 } 18739 18740 static __inline__ vector unsigned long long __ATTRS_o_ai 18741 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 18742 vector unsigned long long __c) { 18743 return __builtin_vsx_xxblendvd(__a, __b, __c); 18744 } 18745 18746 static __inline__ vector float __ATTRS_o_ai 18747 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 18748 return __builtin_vsx_xxblendvw(__a, __b, __c); 18749 } 18750 18751 static __inline__ vector double __ATTRS_o_ai 18752 vec_blendv(vector double __a, vector double __b, 18753 vector unsigned long long __c) { 18754 return __builtin_vsx_xxblendvd(__a, __b, __c); 18755 } 18756 18757 /* vec_replace_elt */ 18758 18759 #define vec_replace_elt __builtin_altivec_vec_replace_elt 18760 18761 /* vec_replace_unaligned */ 18762 18763 #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned 18764 18765 /* vec_splati */ 18766 18767 #define vec_splati(__a) \ 18768 _Generic((__a), signed int \ 18769 : ((vector signed int)__a), unsigned int \ 18770 : ((vector unsigned int)__a), float \ 18771 : ((vector float)__a)) 18772 18773 /* vec_spatid */ 18774 18775 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 18776 return ((vector double)((double)__a)); 18777 } 18778 18779 /* vec_splati_ins */ 18780 18781 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 18782 vector signed int __a, const unsigned int __b, const signed int __c) { 18783 const unsigned int __d = __b & 0x01; 18784 #ifdef __LITTLE_ENDIAN__ 18785 __a[1 - __d] = __c; 18786 __a[3 - __d] = __c; 18787 #else 18788 __a[__d] = __c; 18789 __a[2 + __d] = __c; 18790 #endif 18791 return __a; 18792 } 18793 18794 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 18795 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 18796 const unsigned int __d = __b & 0x01; 18797 #ifdef __LITTLE_ENDIAN__ 18798 __a[1 - __d] = __c; 18799 __a[3 - __d] = __c; 18800 #else 18801 __a[__d] = __c; 18802 __a[2 + __d] = __c; 18803 #endif 18804 return __a; 18805 } 18806 18807 static __inline__ vector float __ATTRS_o_ai 18808 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 18809 const unsigned int __d = __b & 0x01; 18810 #ifdef __LITTLE_ENDIAN__ 18811 __a[1 - __d] = __c; 18812 __a[3 - __d] = __c; 18813 #else 18814 __a[__d] = __c; 18815 __a[2 + __d] = __c; 18816 #endif 18817 return __a; 18818 } 18819 18820 /* vec_test_lsbb_all_ones */ 18821 18822 static __inline__ int __ATTRS_o_ai 18823 vec_test_lsbb_all_ones(vector unsigned char __a) { 18824 return __builtin_vsx_xvtlsbb(__a, 1); 18825 } 18826 18827 /* vec_test_lsbb_all_zeros */ 18828 18829 static __inline__ int __ATTRS_o_ai 18830 vec_test_lsbb_all_zeros(vector unsigned char __a) { 18831 return __builtin_vsx_xvtlsbb(__a, 0); 18832 } 18833 #endif /* __VSX__ */ 18834 18835 /* vec_stril */ 18836 18837 static __inline__ vector unsigned char __ATTRS_o_ai 18838 vec_stril(vector unsigned char __a) { 18839 #ifdef __LITTLE_ENDIAN__ 18840 return __builtin_altivec_vstribr((vector signed char)__a); 18841 #else 18842 return __builtin_altivec_vstribl((vector signed char)__a); 18843 #endif 18844 } 18845 18846 static __inline__ vector signed char __ATTRS_o_ai 18847 vec_stril(vector signed char __a) { 18848 #ifdef __LITTLE_ENDIAN__ 18849 return __builtin_altivec_vstribr(__a); 18850 #else 18851 return __builtin_altivec_vstribl(__a); 18852 #endif 18853 } 18854 18855 static __inline__ vector unsigned short __ATTRS_o_ai 18856 vec_stril(vector unsigned short __a) { 18857 #ifdef __LITTLE_ENDIAN__ 18858 return __builtin_altivec_vstrihr((vector signed short)__a); 18859 #else 18860 return __builtin_altivec_vstrihl((vector signed short)__a); 18861 #endif 18862 } 18863 18864 static __inline__ vector signed short __ATTRS_o_ai 18865 vec_stril(vector signed short __a) { 18866 #ifdef __LITTLE_ENDIAN__ 18867 return __builtin_altivec_vstrihr(__a); 18868 #else 18869 return __builtin_altivec_vstrihl(__a); 18870 #endif 18871 } 18872 18873 /* vec_stril_p */ 18874 18875 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { 18876 #ifdef __LITTLE_ENDIAN__ 18877 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18878 #else 18879 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18880 #endif 18881 } 18882 18883 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { 18884 #ifdef __LITTLE_ENDIAN__ 18885 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18886 #else 18887 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18888 #endif 18889 } 18890 18891 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { 18892 #ifdef __LITTLE_ENDIAN__ 18893 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18894 #else 18895 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18896 #endif 18897 } 18898 18899 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { 18900 #ifdef __LITTLE_ENDIAN__ 18901 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18902 #else 18903 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18904 #endif 18905 } 18906 18907 /* vec_strir */ 18908 18909 static __inline__ vector unsigned char __ATTRS_o_ai 18910 vec_strir(vector unsigned char __a) { 18911 #ifdef __LITTLE_ENDIAN__ 18912 return __builtin_altivec_vstribl((vector signed char)__a); 18913 #else 18914 return __builtin_altivec_vstribr((vector signed char)__a); 18915 #endif 18916 } 18917 18918 static __inline__ vector signed char __ATTRS_o_ai 18919 vec_strir(vector signed char __a) { 18920 #ifdef __LITTLE_ENDIAN__ 18921 return __builtin_altivec_vstribl(__a); 18922 #else 18923 return __builtin_altivec_vstribr(__a); 18924 #endif 18925 } 18926 18927 static __inline__ vector unsigned short __ATTRS_o_ai 18928 vec_strir(vector unsigned short __a) { 18929 #ifdef __LITTLE_ENDIAN__ 18930 return __builtin_altivec_vstrihl((vector signed short)__a); 18931 #else 18932 return __builtin_altivec_vstrihr((vector signed short)__a); 18933 #endif 18934 } 18935 18936 static __inline__ vector signed short __ATTRS_o_ai 18937 vec_strir(vector signed short __a) { 18938 #ifdef __LITTLE_ENDIAN__ 18939 return __builtin_altivec_vstrihl(__a); 18940 #else 18941 return __builtin_altivec_vstrihr(__a); 18942 #endif 18943 } 18944 18945 /* vec_strir_p */ 18946 18947 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { 18948 #ifdef __LITTLE_ENDIAN__ 18949 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18950 #else 18951 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18952 #endif 18953 } 18954 18955 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { 18956 #ifdef __LITTLE_ENDIAN__ 18957 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18958 #else 18959 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18960 #endif 18961 } 18962 18963 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { 18964 #ifdef __LITTLE_ENDIAN__ 18965 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18966 #else 18967 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18968 #endif 18969 } 18970 18971 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { 18972 #ifdef __LITTLE_ENDIAN__ 18973 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18974 #else 18975 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18976 #endif 18977 } 18978 18979 /* vs[l | r | ra] */ 18980 18981 #ifdef __SIZEOF_INT128__ 18982 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18983 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18984 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18985 __CHAR_BIT__)); 18986 } 18987 18988 static __inline__ vector signed __int128 __ATTRS_o_ai 18989 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { 18990 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18991 __CHAR_BIT__)); 18992 } 18993 18994 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18995 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18996 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18997 __CHAR_BIT__)); 18998 } 18999 19000 static __inline__ vector signed __int128 __ATTRS_o_ai 19001 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { 19002 return ( 19003 vector signed __int128)(((vector unsigned __int128)__a) >> 19004 (__b % 19005 (vector unsigned __int128)(sizeof( 19006 unsigned __int128) * 19007 __CHAR_BIT__))); 19008 } 19009 19010 static __inline__ vector unsigned __int128 __ATTRS_o_ai 19011 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { 19012 return ( 19013 vector unsigned __int128)(((vector signed __int128)__a) >> 19014 (__b % 19015 (vector unsigned __int128)(sizeof( 19016 unsigned __int128) * 19017 __CHAR_BIT__))); 19018 } 19019 19020 static __inline__ vector signed __int128 __ATTRS_o_ai 19021 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { 19022 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19023 __CHAR_BIT__)); 19024 } 19025 19026 #endif /* __SIZEOF_INT128__ */ 19027 #endif /* __POWER10_VECTOR__ */ 19028 19029 #undef __ATTRS_o_ai 19030 19031 #endif /* __ALTIVEC_H */ 19032