1 /*===---- altivec.h - Standard header for type generic math ---------------===*\ 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 \*===----------------------------------------------------------------------===*/ 8 9 #ifndef __ALTIVEC_H 10 #define __ALTIVEC_H 11 12 #ifndef __ALTIVEC__ 13 #error "AltiVec support not enabled" 14 #endif 15 16 /* Constants for mapping CR6 bits to predicate result. */ 17 18 #define __CR6_EQ 0 19 #define __CR6_EQ_REV 1 20 #define __CR6_LT 2 21 #define __CR6_LT_REV 3 22 #define __CR6_GT 4 23 #define __CR6_GT_REV 5 24 #define __CR6_SO 6 25 #define __CR6_SO_REV 7 26 27 /* Constants for vec_test_data_class */ 28 #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0) 29 #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1) 30 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \ 31 __VEC_CLASS_FP_SUBNORMAL_N) 32 #define __VEC_CLASS_FP_ZERO_N (1<<2) 33 #define __VEC_CLASS_FP_ZERO_P (1<<3) 34 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \ 35 __VEC_CLASS_FP_ZERO_N) 36 #define __VEC_CLASS_FP_INFINITY_N (1<<4) 37 #define __VEC_CLASS_FP_INFINITY_P (1<<5) 38 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \ 39 __VEC_CLASS_FP_INFINITY_N) 40 #define __VEC_CLASS_FP_NAN (1<<6) 41 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \ 42 __VEC_CLASS_FP_SUBNORMAL | \ 43 __VEC_CLASS_FP_ZERO | \ 44 __VEC_CLASS_FP_INFINITY) 45 46 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) 47 48 #include <stddef.h> 49 50 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 51 vector signed char __a, vector signed char __b, vector unsigned char __c); 52 53 static __inline__ vector unsigned char __ATTRS_o_ai 54 vec_perm(vector unsigned char __a, vector unsigned char __b, 55 vector unsigned char __c); 56 57 static __inline__ vector bool char __ATTRS_o_ai 58 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); 59 60 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 61 vector signed short __b, 62 vector unsigned char __c); 63 64 static __inline__ vector unsigned short __ATTRS_o_ai 65 vec_perm(vector unsigned short __a, vector unsigned short __b, 66 vector unsigned char __c); 67 68 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 69 vector bool short __a, vector bool short __b, vector unsigned char __c); 70 71 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 72 vector pixel __b, 73 vector unsigned char __c); 74 75 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 76 vector signed int __b, 77 vector unsigned char __c); 78 79 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( 80 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); 81 82 static __inline__ vector bool int __ATTRS_o_ai 83 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); 84 85 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 86 vector float __b, 87 vector unsigned char __c); 88 89 #ifdef __VSX__ 90 static __inline__ vector long long __ATTRS_o_ai 91 vec_perm(vector signed long long __a, vector signed long long __b, 92 vector unsigned char __c); 93 94 static __inline__ vector unsigned long long __ATTRS_o_ai 95 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 96 vector unsigned char __c); 97 98 static __inline__ vector bool long long __ATTRS_o_ai 99 vec_perm(vector bool long long __a, vector bool long long __b, 100 vector unsigned char __c); 101 102 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, 103 vector double __b, 104 vector unsigned char __c); 105 #endif 106 107 static __inline__ vector unsigned char __ATTRS_o_ai 108 vec_xor(vector unsigned char __a, vector unsigned char __b); 109 110 /* vec_abs */ 111 112 #define __builtin_altivec_abs_v16qi vec_abs 113 #define __builtin_altivec_abs_v8hi vec_abs 114 #define __builtin_altivec_abs_v4si vec_abs 115 116 static __inline__ vector signed char __ATTRS_o_ai 117 vec_abs(vector signed char __a) { 118 return __builtin_altivec_vmaxsb(__a, -__a); 119 } 120 121 static __inline__ vector signed short __ATTRS_o_ai 122 vec_abs(vector signed short __a) { 123 return __builtin_altivec_vmaxsh(__a, -__a); 124 } 125 126 static __inline__ vector signed int __ATTRS_o_ai 127 vec_abs(vector signed int __a) { 128 return __builtin_altivec_vmaxsw(__a, -__a); 129 } 130 131 #ifdef __POWER8_VECTOR__ 132 static __inline__ vector signed long long __ATTRS_o_ai 133 vec_abs(vector signed long long __a) { 134 return __builtin_altivec_vmaxsd(__a, -__a); 135 } 136 #endif 137 138 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { 139 #ifdef __VSX__ 140 return __builtin_vsx_xvabssp(__a); 141 #else 142 vector unsigned int __res = 143 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); 144 return (vector float)__res; 145 #endif 146 } 147 148 #ifdef __VSX__ 149 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { 150 return __builtin_vsx_xvabsdp(__a); 151 } 152 #endif 153 154 /* vec_abss */ 155 #define __builtin_altivec_abss_v16qi vec_abss 156 #define __builtin_altivec_abss_v8hi vec_abss 157 #define __builtin_altivec_abss_v4si vec_abss 158 159 static __inline__ vector signed char __ATTRS_o_ai 160 vec_abss(vector signed char __a) { 161 return __builtin_altivec_vmaxsb( 162 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); 163 } 164 165 static __inline__ vector signed short __ATTRS_o_ai 166 vec_abss(vector signed short __a) { 167 return __builtin_altivec_vmaxsh( 168 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); 169 } 170 171 static __inline__ vector signed int __ATTRS_o_ai 172 vec_abss(vector signed int __a) { 173 return __builtin_altivec_vmaxsw( 174 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); 175 } 176 177 /* vec_absd */ 178 #if defined(__POWER9_VECTOR__) 179 180 static __inline__ vector unsigned char __ATTRS_o_ai 181 vec_absd(vector unsigned char __a, vector unsigned char __b) { 182 return __builtin_altivec_vabsdub(__a, __b); 183 } 184 185 static __inline__ vector unsigned short __ATTRS_o_ai 186 vec_absd(vector unsigned short __a, vector unsigned short __b) { 187 return __builtin_altivec_vabsduh(__a, __b); 188 } 189 190 static __inline__ vector unsigned int __ATTRS_o_ai 191 vec_absd(vector unsigned int __a, vector unsigned int __b) { 192 return __builtin_altivec_vabsduw(__a, __b); 193 } 194 195 #endif /* End __POWER9_VECTOR__ */ 196 197 /* vec_add */ 198 199 static __inline__ vector signed char __ATTRS_o_ai 200 vec_add(vector signed char __a, vector signed char __b) { 201 return __a + __b; 202 } 203 204 static __inline__ vector signed char __ATTRS_o_ai 205 vec_add(vector bool char __a, vector signed char __b) { 206 return (vector signed char)__a + __b; 207 } 208 209 static __inline__ vector signed char __ATTRS_o_ai 210 vec_add(vector signed char __a, vector bool char __b) { 211 return __a + (vector signed char)__b; 212 } 213 214 static __inline__ vector unsigned char __ATTRS_o_ai 215 vec_add(vector unsigned char __a, vector unsigned char __b) { 216 return __a + __b; 217 } 218 219 static __inline__ vector unsigned char __ATTRS_o_ai 220 vec_add(vector bool char __a, vector unsigned char __b) { 221 return (vector unsigned char)__a + __b; 222 } 223 224 static __inline__ vector unsigned char __ATTRS_o_ai 225 vec_add(vector unsigned char __a, vector bool char __b) { 226 return __a + (vector unsigned char)__b; 227 } 228 229 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 230 vector short __b) { 231 return __a + __b; 232 } 233 234 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, 235 vector short __b) { 236 return (vector short)__a + __b; 237 } 238 239 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 240 vector bool short __b) { 241 return __a + (vector short)__b; 242 } 243 244 static __inline__ vector unsigned short __ATTRS_o_ai 245 vec_add(vector unsigned short __a, vector unsigned short __b) { 246 return __a + __b; 247 } 248 249 static __inline__ vector unsigned short __ATTRS_o_ai 250 vec_add(vector bool short __a, vector unsigned short __b) { 251 return (vector unsigned short)__a + __b; 252 } 253 254 static __inline__ vector unsigned short __ATTRS_o_ai 255 vec_add(vector unsigned short __a, vector bool short __b) { 256 return __a + (vector unsigned short)__b; 257 } 258 259 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 260 vector int __b) { 261 return __a + __b; 262 } 263 264 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, 265 vector int __b) { 266 return (vector int)__a + __b; 267 } 268 269 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 270 vector bool int __b) { 271 return __a + (vector int)__b; 272 } 273 274 static __inline__ vector unsigned int __ATTRS_o_ai 275 vec_add(vector unsigned int __a, vector unsigned int __b) { 276 return __a + __b; 277 } 278 279 static __inline__ vector unsigned int __ATTRS_o_ai 280 vec_add(vector bool int __a, vector unsigned int __b) { 281 return (vector unsigned int)__a + __b; 282 } 283 284 static __inline__ vector unsigned int __ATTRS_o_ai 285 vec_add(vector unsigned int __a, vector bool int __b) { 286 return __a + (vector unsigned int)__b; 287 } 288 289 #ifdef __POWER8_VECTOR__ 290 static __inline__ vector signed long long __ATTRS_o_ai 291 vec_add(vector signed long long __a, vector signed long long __b) { 292 return __a + __b; 293 } 294 295 static __inline__ vector unsigned long long __ATTRS_o_ai 296 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 297 return __a + __b; 298 } 299 300 #ifdef __SIZEOF_INT128__ 301 static __inline__ vector signed __int128 __ATTRS_o_ai 302 vec_add(vector signed __int128 __a, vector signed __int128 __b) { 303 return __a + __b; 304 } 305 306 static __inline__ vector unsigned __int128 __ATTRS_o_ai 307 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { 308 return __a + __b; 309 } 310 #endif 311 312 static __inline__ vector unsigned char __attribute__((__always_inline__)) 313 vec_add_u128(vector unsigned char __a, vector unsigned char __b) { 314 return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b); 315 } 316 #elif defined(__VSX__) 317 static __inline__ vector signed long long __ATTRS_o_ai 318 vec_add(vector signed long long __a, vector signed long long __b) { 319 #ifdef __LITTLE_ENDIAN__ 320 // Little endian systems on CPU's prior to Power8 don't really exist 321 // so scalarizing is fine. 322 return __a + __b; 323 #else 324 vector unsigned int __res = 325 (vector unsigned int)__a + (vector unsigned int)__b; 326 vector unsigned int __carry = __builtin_altivec_vaddcuw( 327 (vector unsigned int)__a, (vector unsigned int)__b); 328 __carry = (vector unsigned int)__builtin_shufflevector( 329 (vector unsigned char)__carry, (vector unsigned char)__carry, 0, 0, 0, 7, 330 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0); 331 return (vector signed long long)(__res + __carry); 332 #endif 333 } 334 335 static __inline__ vector unsigned long long __ATTRS_o_ai 336 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 337 return (vector unsigned long long)vec_add((vector signed long long)__a, 338 (vector signed long long)__b); 339 } 340 #endif // __POWER8_VECTOR__ 341 342 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 343 vector float __b) { 344 return __a + __b; 345 } 346 347 #ifdef __VSX__ 348 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 349 vector double __b) { 350 return __a + __b; 351 } 352 #endif // __VSX__ 353 354 /* vec_adde */ 355 356 #ifdef __POWER8_VECTOR__ 357 #ifdef __SIZEOF_INT128__ 358 static __inline__ vector signed __int128 __ATTRS_o_ai 359 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 360 vector signed __int128 __c) { 361 return (vector signed __int128)__builtin_altivec_vaddeuqm( 362 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 363 (vector unsigned __int128)__c); 364 } 365 366 static __inline__ vector unsigned __int128 __ATTRS_o_ai 367 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 368 vector unsigned __int128 __c) { 369 return __builtin_altivec_vaddeuqm(__a, __b, __c); 370 } 371 #endif 372 373 static __inline__ vector unsigned char __attribute__((__always_inline__)) 374 vec_adde_u128(vector unsigned char __a, vector unsigned char __b, 375 vector unsigned char __c) { 376 return (vector unsigned char)__builtin_altivec_vaddeuqm_c( 377 (vector unsigned char)__a, (vector unsigned char)__b, 378 (vector unsigned char)__c); 379 } 380 #endif 381 382 static __inline__ vector signed int __ATTRS_o_ai 383 vec_adde(vector signed int __a, vector signed int __b, 384 vector signed int __c) { 385 vector signed int __mask = {1, 1, 1, 1}; 386 vector signed int __carry = __c & __mask; 387 return vec_add(vec_add(__a, __b), __carry); 388 } 389 390 static __inline__ vector unsigned int __ATTRS_o_ai 391 vec_adde(vector unsigned int __a, vector unsigned int __b, 392 vector unsigned int __c) { 393 vector unsigned int __mask = {1, 1, 1, 1}; 394 vector unsigned int __carry = __c & __mask; 395 return vec_add(vec_add(__a, __b), __carry); 396 } 397 398 /* vec_addec */ 399 400 #ifdef __POWER8_VECTOR__ 401 #ifdef __SIZEOF_INT128__ 402 static __inline__ vector signed __int128 __ATTRS_o_ai 403 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 404 vector signed __int128 __c) { 405 return (vector signed __int128)__builtin_altivec_vaddecuq( 406 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 407 (vector unsigned __int128)__c); 408 } 409 410 static __inline__ vector unsigned __int128 __ATTRS_o_ai 411 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 412 vector unsigned __int128 __c) { 413 return __builtin_altivec_vaddecuq(__a, __b, __c); 414 } 415 #endif 416 417 static __inline__ vector unsigned char __attribute__((__always_inline__)) 418 vec_addec_u128(vector unsigned char __a, vector unsigned char __b, 419 vector unsigned char __c) { 420 return (vector unsigned char)__builtin_altivec_vaddecuq_c( 421 (vector unsigned char)__a, (vector unsigned char)__b, 422 (vector unsigned char)__c); 423 } 424 425 #ifdef __powerpc64__ 426 static __inline__ vector signed int __ATTRS_o_ai 427 vec_addec(vector signed int __a, vector signed int __b, 428 vector signed int __c) { 429 430 signed int __result[4]; 431 for (int i = 0; i < 4; i++) { 432 unsigned int __tempa = (unsigned int) __a[i]; 433 unsigned int __tempb = (unsigned int) __b[i]; 434 unsigned int __tempc = (unsigned int) __c[i]; 435 __tempc = __tempc & 0x00000001; 436 unsigned long long __longa = (unsigned long long) __tempa; 437 unsigned long long __longb = (unsigned long long) __tempb; 438 unsigned long long __longc = (unsigned long long) __tempc; 439 unsigned long long __sum = __longa + __longb + __longc; 440 unsigned long long __res = (__sum >> 32) & 0x01; 441 unsigned long long __tempres = (unsigned int) __res; 442 __result[i] = (signed int) __tempres; 443 } 444 445 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; 446 return ret; 447 } 448 449 static __inline__ vector unsigned int __ATTRS_o_ai 450 vec_addec(vector unsigned int __a, vector unsigned int __b, 451 vector unsigned int __c) { 452 453 unsigned int __result[4]; 454 for (int i = 0; i < 4; i++) { 455 unsigned int __tempc = __c[i] & 1; 456 unsigned long long __longa = (unsigned long long) __a[i]; 457 unsigned long long __longb = (unsigned long long) __b[i]; 458 unsigned long long __longc = (unsigned long long) __tempc; 459 unsigned long long __sum = __longa + __longb + __longc; 460 unsigned long long __res = (__sum >> 32) & 0x01; 461 unsigned long long __tempres = (unsigned int) __res; 462 __result[i] = (signed int) __tempres; 463 } 464 465 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; 466 return ret; 467 } 468 #endif // __powerpc64__ 469 #endif // __POWER8_VECTOR__ 470 471 /* vec_vaddubm */ 472 473 #define __builtin_altivec_vaddubm vec_vaddubm 474 475 static __inline__ vector signed char __ATTRS_o_ai 476 vec_vaddubm(vector signed char __a, vector signed char __b) { 477 return __a + __b; 478 } 479 480 static __inline__ vector signed char __ATTRS_o_ai 481 vec_vaddubm(vector bool char __a, vector signed char __b) { 482 return (vector signed char)__a + __b; 483 } 484 485 static __inline__ vector signed char __ATTRS_o_ai 486 vec_vaddubm(vector signed char __a, vector bool char __b) { 487 return __a + (vector signed char)__b; 488 } 489 490 static __inline__ vector unsigned char __ATTRS_o_ai 491 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 492 return __a + __b; 493 } 494 495 static __inline__ vector unsigned char __ATTRS_o_ai 496 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 497 return (vector unsigned char)__a + __b; 498 } 499 500 static __inline__ vector unsigned char __ATTRS_o_ai 501 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 502 return __a + (vector unsigned char)__b; 503 } 504 505 /* vec_vadduhm */ 506 507 #define __builtin_altivec_vadduhm vec_vadduhm 508 509 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 510 vector short __b) { 511 return __a + __b; 512 } 513 514 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 515 vector short __b) { 516 return (vector short)__a + __b; 517 } 518 519 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 520 vector bool short __b) { 521 return __a + (vector short)__b; 522 } 523 524 static __inline__ vector unsigned short __ATTRS_o_ai 525 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 526 return __a + __b; 527 } 528 529 static __inline__ vector unsigned short __ATTRS_o_ai 530 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 531 return (vector unsigned short)__a + __b; 532 } 533 534 static __inline__ vector unsigned short __ATTRS_o_ai 535 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 536 return __a + (vector unsigned short)__b; 537 } 538 539 /* vec_vadduwm */ 540 541 #define __builtin_altivec_vadduwm vec_vadduwm 542 543 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 544 vector int __b) { 545 return __a + __b; 546 } 547 548 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 549 vector int __b) { 550 return (vector int)__a + __b; 551 } 552 553 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 554 vector bool int __b) { 555 return __a + (vector int)__b; 556 } 557 558 static __inline__ vector unsigned int __ATTRS_o_ai 559 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 560 return __a + __b; 561 } 562 563 static __inline__ vector unsigned int __ATTRS_o_ai 564 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 565 return (vector unsigned int)__a + __b; 566 } 567 568 static __inline__ vector unsigned int __ATTRS_o_ai 569 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 570 return __a + (vector unsigned int)__b; 571 } 572 573 /* vec_vaddfp */ 574 575 #define __builtin_altivec_vaddfp vec_vaddfp 576 577 static __inline__ vector float __attribute__((__always_inline__)) 578 vec_vaddfp(vector float __a, vector float __b) { 579 return __a + __b; 580 } 581 582 /* vec_addc */ 583 584 static __inline__ vector signed int __ATTRS_o_ai 585 vec_addc(vector signed int __a, vector signed int __b) { 586 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 587 (vector unsigned int)__b); 588 } 589 590 static __inline__ vector unsigned int __ATTRS_o_ai 591 vec_addc(vector unsigned int __a, vector unsigned int __b) { 592 return __builtin_altivec_vaddcuw(__a, __b); 593 } 594 595 #ifdef __POWER8_VECTOR__ 596 #ifdef __SIZEOF_INT128__ 597 static __inline__ vector signed __int128 __ATTRS_o_ai 598 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 599 return (vector signed __int128)__builtin_altivec_vaddcuq( 600 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 601 } 602 603 static __inline__ vector unsigned __int128 __ATTRS_o_ai 604 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 605 return __builtin_altivec_vaddcuq(__a, __b); 606 } 607 #endif 608 609 static __inline__ vector unsigned char __attribute__((__always_inline__)) 610 vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { 611 return (vector unsigned char)__builtin_altivec_vaddcuq_c( 612 (vector unsigned char)__a, (vector unsigned char)__b); 613 } 614 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 615 616 /* vec_vaddcuw */ 617 618 static __inline__ vector unsigned int __attribute__((__always_inline__)) 619 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 620 return __builtin_altivec_vaddcuw(__a, __b); 621 } 622 623 /* vec_adds */ 624 625 static __inline__ vector signed char __ATTRS_o_ai 626 vec_adds(vector signed char __a, vector signed char __b) { 627 return __builtin_altivec_vaddsbs(__a, __b); 628 } 629 630 static __inline__ vector signed char __ATTRS_o_ai 631 vec_adds(vector bool char __a, vector signed char __b) { 632 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 633 } 634 635 static __inline__ vector signed char __ATTRS_o_ai 636 vec_adds(vector signed char __a, vector bool char __b) { 637 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 638 } 639 640 static __inline__ vector unsigned char __ATTRS_o_ai 641 vec_adds(vector unsigned char __a, vector unsigned char __b) { 642 return __builtin_altivec_vaddubs(__a, __b); 643 } 644 645 static __inline__ vector unsigned char __ATTRS_o_ai 646 vec_adds(vector bool char __a, vector unsigned char __b) { 647 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 648 } 649 650 static __inline__ vector unsigned char __ATTRS_o_ai 651 vec_adds(vector unsigned char __a, vector bool char __b) { 652 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 653 } 654 655 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 656 vector short __b) { 657 return __builtin_altivec_vaddshs(__a, __b); 658 } 659 660 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 661 vector short __b) { 662 return __builtin_altivec_vaddshs((vector short)__a, __b); 663 } 664 665 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 666 vector bool short __b) { 667 return __builtin_altivec_vaddshs(__a, (vector short)__b); 668 } 669 670 static __inline__ vector unsigned short __ATTRS_o_ai 671 vec_adds(vector unsigned short __a, vector unsigned short __b) { 672 return __builtin_altivec_vadduhs(__a, __b); 673 } 674 675 static __inline__ vector unsigned short __ATTRS_o_ai 676 vec_adds(vector bool short __a, vector unsigned short __b) { 677 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 678 } 679 680 static __inline__ vector unsigned short __ATTRS_o_ai 681 vec_adds(vector unsigned short __a, vector bool short __b) { 682 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 683 } 684 685 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 686 vector int __b) { 687 return __builtin_altivec_vaddsws(__a, __b); 688 } 689 690 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 691 vector int __b) { 692 return __builtin_altivec_vaddsws((vector int)__a, __b); 693 } 694 695 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 696 vector bool int __b) { 697 return __builtin_altivec_vaddsws(__a, (vector int)__b); 698 } 699 700 static __inline__ vector unsigned int __ATTRS_o_ai 701 vec_adds(vector unsigned int __a, vector unsigned int __b) { 702 return __builtin_altivec_vadduws(__a, __b); 703 } 704 705 static __inline__ vector unsigned int __ATTRS_o_ai 706 vec_adds(vector bool int __a, vector unsigned int __b) { 707 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 708 } 709 710 static __inline__ vector unsigned int __ATTRS_o_ai 711 vec_adds(vector unsigned int __a, vector bool int __b) { 712 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 713 } 714 715 /* vec_vaddsbs */ 716 717 static __inline__ vector signed char __ATTRS_o_ai 718 vec_vaddsbs(vector signed char __a, vector signed char __b) { 719 return __builtin_altivec_vaddsbs(__a, __b); 720 } 721 722 static __inline__ vector signed char __ATTRS_o_ai 723 vec_vaddsbs(vector bool char __a, vector signed char __b) { 724 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 725 } 726 727 static __inline__ vector signed char __ATTRS_o_ai 728 vec_vaddsbs(vector signed char __a, vector bool char __b) { 729 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 730 } 731 732 /* vec_vaddubs */ 733 734 static __inline__ vector unsigned char __ATTRS_o_ai 735 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 736 return __builtin_altivec_vaddubs(__a, __b); 737 } 738 739 static __inline__ vector unsigned char __ATTRS_o_ai 740 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 741 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 742 } 743 744 static __inline__ vector unsigned char __ATTRS_o_ai 745 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 746 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 747 } 748 749 /* vec_vaddshs */ 750 751 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 752 vector short __b) { 753 return __builtin_altivec_vaddshs(__a, __b); 754 } 755 756 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 757 vector short __b) { 758 return __builtin_altivec_vaddshs((vector short)__a, __b); 759 } 760 761 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 762 vector bool short __b) { 763 return __builtin_altivec_vaddshs(__a, (vector short)__b); 764 } 765 766 /* vec_vadduhs */ 767 768 static __inline__ vector unsigned short __ATTRS_o_ai 769 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 770 return __builtin_altivec_vadduhs(__a, __b); 771 } 772 773 static __inline__ vector unsigned short __ATTRS_o_ai 774 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 775 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 776 } 777 778 static __inline__ vector unsigned short __ATTRS_o_ai 779 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 780 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 781 } 782 783 /* vec_vaddsws */ 784 785 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 786 vector int __b) { 787 return __builtin_altivec_vaddsws(__a, __b); 788 } 789 790 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 791 vector int __b) { 792 return __builtin_altivec_vaddsws((vector int)__a, __b); 793 } 794 795 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 796 vector bool int __b) { 797 return __builtin_altivec_vaddsws(__a, (vector int)__b); 798 } 799 800 /* vec_vadduws */ 801 802 static __inline__ vector unsigned int __ATTRS_o_ai 803 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 804 return __builtin_altivec_vadduws(__a, __b); 805 } 806 807 static __inline__ vector unsigned int __ATTRS_o_ai 808 vec_vadduws(vector bool int __a, vector unsigned int __b) { 809 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 810 } 811 812 static __inline__ vector unsigned int __ATTRS_o_ai 813 vec_vadduws(vector unsigned int __a, vector bool int __b) { 814 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 815 } 816 817 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 818 defined(__SIZEOF_INT128__) 819 /* vec_vadduqm */ 820 821 static __inline__ vector signed __int128 __ATTRS_o_ai 822 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 823 return __a + __b; 824 } 825 826 static __inline__ vector unsigned __int128 __ATTRS_o_ai 827 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 828 return __a + __b; 829 } 830 831 /* vec_vaddeuqm */ 832 833 static __inline__ vector signed __int128 __ATTRS_o_ai 834 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 835 vector signed __int128 __c) { 836 return (vector signed __int128)__builtin_altivec_vaddeuqm( 837 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 838 (vector unsigned __int128)__c); 839 } 840 841 static __inline__ vector unsigned __int128 __ATTRS_o_ai 842 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 843 vector unsigned __int128 __c) { 844 return __builtin_altivec_vaddeuqm(__a, __b, __c); 845 } 846 847 /* vec_vaddcuq */ 848 849 static __inline__ vector signed __int128 __ATTRS_o_ai 850 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 851 return (vector signed __int128)__builtin_altivec_vaddcuq( 852 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 853 } 854 855 static __inline__ vector unsigned __int128 __ATTRS_o_ai 856 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 857 return __builtin_altivec_vaddcuq(__a, __b); 858 } 859 860 /* vec_vaddecuq */ 861 862 static __inline__ vector signed __int128 __ATTRS_o_ai 863 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 864 vector signed __int128 __c) { 865 return (vector signed __int128)__builtin_altivec_vaddecuq( 866 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 867 (vector unsigned __int128)__c); 868 } 869 870 static __inline__ vector unsigned __int128 __ATTRS_o_ai 871 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 872 vector unsigned __int128 __c) { 873 return __builtin_altivec_vaddecuq(__a, __b, __c); 874 } 875 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 876 877 /* vec_and */ 878 879 #define __builtin_altivec_vand vec_and 880 881 static __inline__ vector signed char __ATTRS_o_ai 882 vec_and(vector signed char __a, vector signed char __b) { 883 return __a & __b; 884 } 885 886 static __inline__ vector signed char __ATTRS_o_ai 887 vec_and(vector bool char __a, vector signed char __b) { 888 return (vector signed char)__a & __b; 889 } 890 891 static __inline__ vector signed char __ATTRS_o_ai 892 vec_and(vector signed char __a, vector bool char __b) { 893 return __a & (vector signed char)__b; 894 } 895 896 static __inline__ vector unsigned char __ATTRS_o_ai 897 vec_and(vector unsigned char __a, vector unsigned char __b) { 898 return __a & __b; 899 } 900 901 static __inline__ vector unsigned char __ATTRS_o_ai 902 vec_and(vector bool char __a, vector unsigned char __b) { 903 return (vector unsigned char)__a & __b; 904 } 905 906 static __inline__ vector unsigned char __ATTRS_o_ai 907 vec_and(vector unsigned char __a, vector bool char __b) { 908 return __a & (vector unsigned char)__b; 909 } 910 911 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 912 vector bool char __b) { 913 return __a & __b; 914 } 915 916 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 917 vector short __b) { 918 return __a & __b; 919 } 920 921 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 922 vector short __b) { 923 return (vector short)__a & __b; 924 } 925 926 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 927 vector bool short __b) { 928 return __a & (vector short)__b; 929 } 930 931 static __inline__ vector unsigned short __ATTRS_o_ai 932 vec_and(vector unsigned short __a, vector unsigned short __b) { 933 return __a & __b; 934 } 935 936 static __inline__ vector unsigned short __ATTRS_o_ai 937 vec_and(vector bool short __a, vector unsigned short __b) { 938 return (vector unsigned short)__a & __b; 939 } 940 941 static __inline__ vector unsigned short __ATTRS_o_ai 942 vec_and(vector unsigned short __a, vector bool short __b) { 943 return __a & (vector unsigned short)__b; 944 } 945 946 static __inline__ vector bool short __ATTRS_o_ai 947 vec_and(vector bool short __a, vector bool short __b) { 948 return __a & __b; 949 } 950 951 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 952 vector int __b) { 953 return __a & __b; 954 } 955 956 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 957 vector int __b) { 958 return (vector int)__a & __b; 959 } 960 961 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 962 vector bool int __b) { 963 return __a & (vector int)__b; 964 } 965 966 static __inline__ vector unsigned int __ATTRS_o_ai 967 vec_and(vector unsigned int __a, vector unsigned int __b) { 968 return __a & __b; 969 } 970 971 static __inline__ vector unsigned int __ATTRS_o_ai 972 vec_and(vector bool int __a, vector unsigned int __b) { 973 return (vector unsigned int)__a & __b; 974 } 975 976 static __inline__ vector unsigned int __ATTRS_o_ai 977 vec_and(vector unsigned int __a, vector bool int __b) { 978 return __a & (vector unsigned int)__b; 979 } 980 981 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 982 vector bool int __b) { 983 return __a & __b; 984 } 985 986 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 987 vector float __b) { 988 vector unsigned int __res = 989 (vector unsigned int)__a & (vector unsigned int)__b; 990 return (vector float)__res; 991 } 992 993 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 994 vector float __b) { 995 vector unsigned int __res = 996 (vector unsigned int)__a & (vector unsigned int)__b; 997 return (vector float)__res; 998 } 999 1000 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 1001 vector bool int __b) { 1002 vector unsigned int __res = 1003 (vector unsigned int)__a & (vector unsigned int)__b; 1004 return (vector float)__res; 1005 } 1006 1007 #ifdef __VSX__ 1008 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 1009 vector double __b) { 1010 vector unsigned long long __res = 1011 (vector unsigned long long)__a & (vector unsigned long long)__b; 1012 return (vector double)__res; 1013 } 1014 1015 static __inline__ vector double __ATTRS_o_ai 1016 vec_and(vector double __a, vector bool long long __b) { 1017 vector unsigned long long __res = 1018 (vector unsigned long long)__a & (vector unsigned long long)__b; 1019 return (vector double)__res; 1020 } 1021 1022 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 1023 vector double __b) { 1024 vector unsigned long long __res = 1025 (vector unsigned long long)__a & (vector unsigned long long)__b; 1026 return (vector double)__res; 1027 } 1028 1029 static __inline__ vector signed long long __ATTRS_o_ai 1030 vec_and(vector signed long long __a, vector signed long long __b) { 1031 return __a & __b; 1032 } 1033 1034 static __inline__ vector signed long long __ATTRS_o_ai 1035 vec_and(vector bool long long __a, vector signed long long __b) { 1036 return (vector signed long long)__a & __b; 1037 } 1038 1039 static __inline__ vector signed long long __ATTRS_o_ai 1040 vec_and(vector signed long long __a, vector bool long long __b) { 1041 return __a & (vector signed long long)__b; 1042 } 1043 1044 static __inline__ vector unsigned long long __ATTRS_o_ai 1045 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 1046 return __a & __b; 1047 } 1048 1049 static __inline__ vector unsigned long long __ATTRS_o_ai 1050 vec_and(vector bool long long __a, vector unsigned long long __b) { 1051 return (vector unsigned long long)__a & __b; 1052 } 1053 1054 static __inline__ vector unsigned long long __ATTRS_o_ai 1055 vec_and(vector unsigned long long __a, vector bool long long __b) { 1056 return __a & (vector unsigned long long)__b; 1057 } 1058 1059 static __inline__ vector bool long long __ATTRS_o_ai 1060 vec_and(vector bool long long __a, vector bool long long __b) { 1061 return __a & __b; 1062 } 1063 #endif 1064 1065 /* vec_vand */ 1066 1067 static __inline__ vector signed char __ATTRS_o_ai 1068 vec_vand(vector signed char __a, vector signed char __b) { 1069 return __a & __b; 1070 } 1071 1072 static __inline__ vector signed char __ATTRS_o_ai 1073 vec_vand(vector bool char __a, vector signed char __b) { 1074 return (vector signed char)__a & __b; 1075 } 1076 1077 static __inline__ vector signed char __ATTRS_o_ai 1078 vec_vand(vector signed char __a, vector bool char __b) { 1079 return __a & (vector signed char)__b; 1080 } 1081 1082 static __inline__ vector unsigned char __ATTRS_o_ai 1083 vec_vand(vector unsigned char __a, vector unsigned char __b) { 1084 return __a & __b; 1085 } 1086 1087 static __inline__ vector unsigned char __ATTRS_o_ai 1088 vec_vand(vector bool char __a, vector unsigned char __b) { 1089 return (vector unsigned char)__a & __b; 1090 } 1091 1092 static __inline__ vector unsigned char __ATTRS_o_ai 1093 vec_vand(vector unsigned char __a, vector bool char __b) { 1094 return __a & (vector unsigned char)__b; 1095 } 1096 1097 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 1098 vector bool char __b) { 1099 return __a & __b; 1100 } 1101 1102 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1103 vector short __b) { 1104 return __a & __b; 1105 } 1106 1107 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 1108 vector short __b) { 1109 return (vector short)__a & __b; 1110 } 1111 1112 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1113 vector bool short __b) { 1114 return __a & (vector short)__b; 1115 } 1116 1117 static __inline__ vector unsigned short __ATTRS_o_ai 1118 vec_vand(vector unsigned short __a, vector unsigned short __b) { 1119 return __a & __b; 1120 } 1121 1122 static __inline__ vector unsigned short __ATTRS_o_ai 1123 vec_vand(vector bool short __a, vector unsigned short __b) { 1124 return (vector unsigned short)__a & __b; 1125 } 1126 1127 static __inline__ vector unsigned short __ATTRS_o_ai 1128 vec_vand(vector unsigned short __a, vector bool short __b) { 1129 return __a & (vector unsigned short)__b; 1130 } 1131 1132 static __inline__ vector bool short __ATTRS_o_ai 1133 vec_vand(vector bool short __a, vector bool short __b) { 1134 return __a & __b; 1135 } 1136 1137 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1138 vector int __b) { 1139 return __a & __b; 1140 } 1141 1142 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 1143 vector int __b) { 1144 return (vector int)__a & __b; 1145 } 1146 1147 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1148 vector bool int __b) { 1149 return __a & (vector int)__b; 1150 } 1151 1152 static __inline__ vector unsigned int __ATTRS_o_ai 1153 vec_vand(vector unsigned int __a, vector unsigned int __b) { 1154 return __a & __b; 1155 } 1156 1157 static __inline__ vector unsigned int __ATTRS_o_ai 1158 vec_vand(vector bool int __a, vector unsigned int __b) { 1159 return (vector unsigned int)__a & __b; 1160 } 1161 1162 static __inline__ vector unsigned int __ATTRS_o_ai 1163 vec_vand(vector unsigned int __a, vector bool int __b) { 1164 return __a & (vector unsigned int)__b; 1165 } 1166 1167 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1168 vector bool int __b) { 1169 return __a & __b; 1170 } 1171 1172 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1173 vector float __b) { 1174 vector unsigned int __res = 1175 (vector unsigned int)__a & (vector unsigned int)__b; 1176 return (vector float)__res; 1177 } 1178 1179 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1180 vector float __b) { 1181 vector unsigned int __res = 1182 (vector unsigned int)__a & (vector unsigned int)__b; 1183 return (vector float)__res; 1184 } 1185 1186 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1187 vector bool int __b) { 1188 vector unsigned int __res = 1189 (vector unsigned int)__a & (vector unsigned int)__b; 1190 return (vector float)__res; 1191 } 1192 1193 #ifdef __VSX__ 1194 static __inline__ vector signed long long __ATTRS_o_ai 1195 vec_vand(vector signed long long __a, vector signed long long __b) { 1196 return __a & __b; 1197 } 1198 1199 static __inline__ vector signed long long __ATTRS_o_ai 1200 vec_vand(vector bool long long __a, vector signed long long __b) { 1201 return (vector signed long long)__a & __b; 1202 } 1203 1204 static __inline__ vector signed long long __ATTRS_o_ai 1205 vec_vand(vector signed long long __a, vector bool long long __b) { 1206 return __a & (vector signed long long)__b; 1207 } 1208 1209 static __inline__ vector unsigned long long __ATTRS_o_ai 1210 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1211 return __a & __b; 1212 } 1213 1214 static __inline__ vector unsigned long long __ATTRS_o_ai 1215 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1216 return (vector unsigned long long)__a & __b; 1217 } 1218 1219 static __inline__ vector unsigned long long __ATTRS_o_ai 1220 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1221 return __a & (vector unsigned long long)__b; 1222 } 1223 1224 static __inline__ vector bool long long __ATTRS_o_ai 1225 vec_vand(vector bool long long __a, vector bool long long __b) { 1226 return __a & __b; 1227 } 1228 #endif 1229 1230 /* vec_andc */ 1231 1232 #define __builtin_altivec_vandc vec_andc 1233 1234 static __inline__ vector signed char __ATTRS_o_ai 1235 vec_andc(vector signed char __a, vector signed char __b) { 1236 return __a & ~__b; 1237 } 1238 1239 static __inline__ vector signed char __ATTRS_o_ai 1240 vec_andc(vector bool char __a, vector signed char __b) { 1241 return (vector signed char)__a & ~__b; 1242 } 1243 1244 static __inline__ vector signed char __ATTRS_o_ai 1245 vec_andc(vector signed char __a, vector bool char __b) { 1246 return __a & ~(vector signed char)__b; 1247 } 1248 1249 static __inline__ vector unsigned char __ATTRS_o_ai 1250 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1251 return __a & ~__b; 1252 } 1253 1254 static __inline__ vector unsigned char __ATTRS_o_ai 1255 vec_andc(vector bool char __a, vector unsigned char __b) { 1256 return (vector unsigned char)__a & ~__b; 1257 } 1258 1259 static __inline__ vector unsigned char __ATTRS_o_ai 1260 vec_andc(vector unsigned char __a, vector bool char __b) { 1261 return __a & ~(vector unsigned char)__b; 1262 } 1263 1264 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1265 vector bool char __b) { 1266 return __a & ~__b; 1267 } 1268 1269 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1270 vector short __b) { 1271 return __a & ~__b; 1272 } 1273 1274 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1275 vector short __b) { 1276 return (vector short)__a & ~__b; 1277 } 1278 1279 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1280 vector bool short __b) { 1281 return __a & ~(vector short)__b; 1282 } 1283 1284 static __inline__ vector unsigned short __ATTRS_o_ai 1285 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1286 return __a & ~__b; 1287 } 1288 1289 static __inline__ vector unsigned short __ATTRS_o_ai 1290 vec_andc(vector bool short __a, vector unsigned short __b) { 1291 return (vector unsigned short)__a & ~__b; 1292 } 1293 1294 static __inline__ vector unsigned short __ATTRS_o_ai 1295 vec_andc(vector unsigned short __a, vector bool short __b) { 1296 return __a & ~(vector unsigned short)__b; 1297 } 1298 1299 static __inline__ vector bool short __ATTRS_o_ai 1300 vec_andc(vector bool short __a, vector bool short __b) { 1301 return __a & ~__b; 1302 } 1303 1304 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1305 vector int __b) { 1306 return __a & ~__b; 1307 } 1308 1309 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1310 vector int __b) { 1311 return (vector int)__a & ~__b; 1312 } 1313 1314 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1315 vector bool int __b) { 1316 return __a & ~(vector int)__b; 1317 } 1318 1319 static __inline__ vector unsigned int __ATTRS_o_ai 1320 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1321 return __a & ~__b; 1322 } 1323 1324 static __inline__ vector unsigned int __ATTRS_o_ai 1325 vec_andc(vector bool int __a, vector unsigned int __b) { 1326 return (vector unsigned int)__a & ~__b; 1327 } 1328 1329 static __inline__ vector unsigned int __ATTRS_o_ai 1330 vec_andc(vector unsigned int __a, vector bool int __b) { 1331 return __a & ~(vector unsigned int)__b; 1332 } 1333 1334 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1335 vector bool int __b) { 1336 return __a & ~__b; 1337 } 1338 1339 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1340 vector float __b) { 1341 vector unsigned int __res = 1342 (vector unsigned int)__a & ~(vector unsigned int)__b; 1343 return (vector float)__res; 1344 } 1345 1346 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1347 vector float __b) { 1348 vector unsigned int __res = 1349 (vector unsigned int)__a & ~(vector unsigned int)__b; 1350 return (vector float)__res; 1351 } 1352 1353 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1354 vector bool int __b) { 1355 vector unsigned int __res = 1356 (vector unsigned int)__a & ~(vector unsigned int)__b; 1357 return (vector float)__res; 1358 } 1359 1360 #ifdef __VSX__ 1361 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1362 vector double __b) { 1363 vector unsigned long long __res = 1364 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1365 return (vector double)__res; 1366 } 1367 1368 static __inline__ vector double __ATTRS_o_ai 1369 vec_andc(vector double __a, vector bool long long __b) { 1370 vector unsigned long long __res = 1371 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1372 return (vector double)__res; 1373 } 1374 1375 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1376 vector double __b) { 1377 vector unsigned long long __res = 1378 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1379 return (vector double)__res; 1380 } 1381 1382 static __inline__ vector signed long long __ATTRS_o_ai 1383 vec_andc(vector signed long long __a, vector signed long long __b) { 1384 return __a & ~__b; 1385 } 1386 1387 static __inline__ vector signed long long __ATTRS_o_ai 1388 vec_andc(vector bool long long __a, vector signed long long __b) { 1389 return (vector signed long long)__a & ~__b; 1390 } 1391 1392 static __inline__ vector signed long long __ATTRS_o_ai 1393 vec_andc(vector signed long long __a, vector bool long long __b) { 1394 return __a & ~(vector signed long long)__b; 1395 } 1396 1397 static __inline__ vector unsigned long long __ATTRS_o_ai 1398 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1399 return __a & ~__b; 1400 } 1401 1402 static __inline__ vector unsigned long long __ATTRS_o_ai 1403 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1404 return (vector unsigned long long)__a & ~__b; 1405 } 1406 1407 static __inline__ vector unsigned long long __ATTRS_o_ai 1408 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1409 return __a & ~(vector unsigned long long)__b; 1410 } 1411 1412 static __inline__ vector bool long long __ATTRS_o_ai 1413 vec_andc(vector bool long long __a, vector bool long long __b) { 1414 return __a & ~__b; 1415 } 1416 #endif 1417 1418 /* vec_vandc */ 1419 1420 static __inline__ vector signed char __ATTRS_o_ai 1421 vec_vandc(vector signed char __a, vector signed char __b) { 1422 return __a & ~__b; 1423 } 1424 1425 static __inline__ vector signed char __ATTRS_o_ai 1426 vec_vandc(vector bool char __a, vector signed char __b) { 1427 return (vector signed char)__a & ~__b; 1428 } 1429 1430 static __inline__ vector signed char __ATTRS_o_ai 1431 vec_vandc(vector signed char __a, vector bool char __b) { 1432 return __a & ~(vector signed char)__b; 1433 } 1434 1435 static __inline__ vector unsigned char __ATTRS_o_ai 1436 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1437 return __a & ~__b; 1438 } 1439 1440 static __inline__ vector unsigned char __ATTRS_o_ai 1441 vec_vandc(vector bool char __a, vector unsigned char __b) { 1442 return (vector unsigned char)__a & ~__b; 1443 } 1444 1445 static __inline__ vector unsigned char __ATTRS_o_ai 1446 vec_vandc(vector unsigned char __a, vector bool char __b) { 1447 return __a & ~(vector unsigned char)__b; 1448 } 1449 1450 static __inline__ vector bool char __ATTRS_o_ai 1451 vec_vandc(vector bool char __a, vector bool char __b) { 1452 return __a & ~__b; 1453 } 1454 1455 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1456 vector short __b) { 1457 return __a & ~__b; 1458 } 1459 1460 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1461 vector short __b) { 1462 return (vector short)__a & ~__b; 1463 } 1464 1465 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1466 vector bool short __b) { 1467 return __a & ~(vector short)__b; 1468 } 1469 1470 static __inline__ vector unsigned short __ATTRS_o_ai 1471 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1472 return __a & ~__b; 1473 } 1474 1475 static __inline__ vector unsigned short __ATTRS_o_ai 1476 vec_vandc(vector bool short __a, vector unsigned short __b) { 1477 return (vector unsigned short)__a & ~__b; 1478 } 1479 1480 static __inline__ vector unsigned short __ATTRS_o_ai 1481 vec_vandc(vector unsigned short __a, vector bool short __b) { 1482 return __a & ~(vector unsigned short)__b; 1483 } 1484 1485 static __inline__ vector bool short __ATTRS_o_ai 1486 vec_vandc(vector bool short __a, vector bool short __b) { 1487 return __a & ~__b; 1488 } 1489 1490 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1491 vector int __b) { 1492 return __a & ~__b; 1493 } 1494 1495 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1496 vector int __b) { 1497 return (vector int)__a & ~__b; 1498 } 1499 1500 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1501 vector bool int __b) { 1502 return __a & ~(vector int)__b; 1503 } 1504 1505 static __inline__ vector unsigned int __ATTRS_o_ai 1506 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1507 return __a & ~__b; 1508 } 1509 1510 static __inline__ vector unsigned int __ATTRS_o_ai 1511 vec_vandc(vector bool int __a, vector unsigned int __b) { 1512 return (vector unsigned int)__a & ~__b; 1513 } 1514 1515 static __inline__ vector unsigned int __ATTRS_o_ai 1516 vec_vandc(vector unsigned int __a, vector bool int __b) { 1517 return __a & ~(vector unsigned int)__b; 1518 } 1519 1520 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1521 vector bool int __b) { 1522 return __a & ~__b; 1523 } 1524 1525 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1526 vector float __b) { 1527 vector unsigned int __res = 1528 (vector unsigned int)__a & ~(vector unsigned int)__b; 1529 return (vector float)__res; 1530 } 1531 1532 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1533 vector float __b) { 1534 vector unsigned int __res = 1535 (vector unsigned int)__a & ~(vector unsigned int)__b; 1536 return (vector float)__res; 1537 } 1538 1539 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1540 vector bool int __b) { 1541 vector unsigned int __res = 1542 (vector unsigned int)__a & ~(vector unsigned int)__b; 1543 return (vector float)__res; 1544 } 1545 1546 #ifdef __VSX__ 1547 static __inline__ vector signed long long __ATTRS_o_ai 1548 vec_vandc(vector signed long long __a, vector signed long long __b) { 1549 return __a & ~__b; 1550 } 1551 1552 static __inline__ vector signed long long __ATTRS_o_ai 1553 vec_vandc(vector bool long long __a, vector signed long long __b) { 1554 return (vector signed long long)__a & ~__b; 1555 } 1556 1557 static __inline__ vector signed long long __ATTRS_o_ai 1558 vec_vandc(vector signed long long __a, vector bool long long __b) { 1559 return __a & ~(vector signed long long)__b; 1560 } 1561 1562 static __inline__ vector unsigned long long __ATTRS_o_ai 1563 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1564 return __a & ~__b; 1565 } 1566 1567 static __inline__ vector unsigned long long __ATTRS_o_ai 1568 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1569 return (vector unsigned long long)__a & ~__b; 1570 } 1571 1572 static __inline__ vector unsigned long long __ATTRS_o_ai 1573 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1574 return __a & ~(vector unsigned long long)__b; 1575 } 1576 1577 static __inline__ vector bool long long __ATTRS_o_ai 1578 vec_vandc(vector bool long long __a, vector bool long long __b) { 1579 return __a & ~__b; 1580 } 1581 #endif 1582 1583 /* vec_avg */ 1584 1585 static __inline__ vector signed char __ATTRS_o_ai 1586 vec_avg(vector signed char __a, vector signed char __b) { 1587 return __builtin_altivec_vavgsb(__a, __b); 1588 } 1589 1590 static __inline__ vector unsigned char __ATTRS_o_ai 1591 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1592 return __builtin_altivec_vavgub(__a, __b); 1593 } 1594 1595 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1596 vector short __b) { 1597 return __builtin_altivec_vavgsh(__a, __b); 1598 } 1599 1600 static __inline__ vector unsigned short __ATTRS_o_ai 1601 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1602 return __builtin_altivec_vavguh(__a, __b); 1603 } 1604 1605 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1606 vector int __b) { 1607 return __builtin_altivec_vavgsw(__a, __b); 1608 } 1609 1610 static __inline__ vector unsigned int __ATTRS_o_ai 1611 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1612 return __builtin_altivec_vavguw(__a, __b); 1613 } 1614 1615 /* vec_vavgsb */ 1616 1617 static __inline__ vector signed char __attribute__((__always_inline__)) 1618 vec_vavgsb(vector signed char __a, vector signed char __b) { 1619 return __builtin_altivec_vavgsb(__a, __b); 1620 } 1621 1622 /* vec_vavgub */ 1623 1624 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1625 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1626 return __builtin_altivec_vavgub(__a, __b); 1627 } 1628 1629 /* vec_vavgsh */ 1630 1631 static __inline__ vector short __attribute__((__always_inline__)) 1632 vec_vavgsh(vector short __a, vector short __b) { 1633 return __builtin_altivec_vavgsh(__a, __b); 1634 } 1635 1636 /* vec_vavguh */ 1637 1638 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1639 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1640 return __builtin_altivec_vavguh(__a, __b); 1641 } 1642 1643 /* vec_vavgsw */ 1644 1645 static __inline__ vector int __attribute__((__always_inline__)) 1646 vec_vavgsw(vector int __a, vector int __b) { 1647 return __builtin_altivec_vavgsw(__a, __b); 1648 } 1649 1650 /* vec_vavguw */ 1651 1652 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1653 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1654 return __builtin_altivec_vavguw(__a, __b); 1655 } 1656 1657 /* vec_ceil */ 1658 1659 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1660 #ifdef __VSX__ 1661 return __builtin_vsx_xvrspip(__a); 1662 #else 1663 return __builtin_altivec_vrfip(__a); 1664 #endif 1665 } 1666 1667 #ifdef __VSX__ 1668 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1669 return __builtin_vsx_xvrdpip(__a); 1670 } 1671 #endif 1672 1673 /* vec_roundp */ 1674 static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { 1675 return vec_ceil(__a); 1676 } 1677 1678 #ifdef __VSX__ 1679 static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { 1680 return vec_ceil(__a); 1681 } 1682 #endif 1683 1684 /* vec_vrfip */ 1685 1686 static __inline__ vector float __attribute__((__always_inline__)) 1687 vec_vrfip(vector float __a) { 1688 return __builtin_altivec_vrfip(__a); 1689 } 1690 1691 /* vec_cmpb */ 1692 1693 static __inline__ vector int __attribute__((__always_inline__)) 1694 vec_cmpb(vector float __a, vector float __b) { 1695 return __builtin_altivec_vcmpbfp(__a, __b); 1696 } 1697 1698 /* vec_vcmpbfp */ 1699 1700 static __inline__ vector int __attribute__((__always_inline__)) 1701 vec_vcmpbfp(vector float __a, vector float __b) { 1702 return __builtin_altivec_vcmpbfp(__a, __b); 1703 } 1704 1705 /* vec_cmpeq */ 1706 1707 static __inline__ vector bool char __ATTRS_o_ai 1708 vec_cmpeq(vector signed char __a, vector signed char __b) { 1709 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1710 (vector char)__b); 1711 } 1712 1713 static __inline__ vector bool char __ATTRS_o_ai 1714 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1715 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1716 (vector char)__b); 1717 } 1718 1719 static __inline__ vector bool char __ATTRS_o_ai 1720 vec_cmpeq(vector bool char __a, vector bool char __b) { 1721 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1722 (vector char)__b); 1723 } 1724 1725 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1726 vector short __b) { 1727 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1728 } 1729 1730 static __inline__ vector bool short __ATTRS_o_ai 1731 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1732 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1733 (vector short)__b); 1734 } 1735 1736 static __inline__ vector bool short __ATTRS_o_ai 1737 vec_cmpeq(vector bool short __a, vector bool short __b) { 1738 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1739 (vector short)__b); 1740 } 1741 1742 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1743 vector int __b) { 1744 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1745 } 1746 1747 static __inline__ vector bool int __ATTRS_o_ai 1748 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1749 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1750 (vector int)__b); 1751 } 1752 1753 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, 1754 vector bool int __b) { 1755 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1756 (vector int)__b); 1757 } 1758 1759 #ifdef __POWER8_VECTOR__ 1760 static __inline__ vector bool long long __ATTRS_o_ai 1761 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1762 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1763 } 1764 1765 static __inline__ vector bool long long __ATTRS_o_ai 1766 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1767 return (vector bool long long)__builtin_altivec_vcmpequd( 1768 (vector long long)__a, (vector long long)__b); 1769 } 1770 1771 static __inline__ vector bool long long __ATTRS_o_ai 1772 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1773 return (vector bool long long)__builtin_altivec_vcmpequd( 1774 (vector long long)__a, (vector long long)__b); 1775 } 1776 #elif defined(__VSX__) 1777 static __inline__ vector bool long long __ATTRS_o_ai 1778 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1779 vector bool int __wordcmp = 1780 vec_cmpeq((vector signed int)__a, (vector signed int)__b); 1781 #ifdef __LITTLE_ENDIAN__ 1782 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); 1783 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, 1784 1, 3, 3); 1785 #else 1786 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); 1787 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, 1788 0, 2, 2); 1789 #endif 1790 } 1791 1792 static __inline__ vector bool long long __ATTRS_o_ai 1793 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1794 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1795 } 1796 1797 static __inline__ vector bool long long __ATTRS_o_ai 1798 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1799 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1800 } 1801 #endif 1802 1803 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1804 vector float __b) { 1805 #ifdef __VSX__ 1806 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1807 #else 1808 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1809 #endif 1810 } 1811 1812 #ifdef __VSX__ 1813 static __inline__ vector bool long long __ATTRS_o_ai 1814 vec_cmpeq(vector double __a, vector double __b) { 1815 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1816 } 1817 #endif 1818 1819 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1820 static __inline__ vector bool __int128 __ATTRS_o_ai 1821 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { 1822 return (vector bool __int128)__builtin_altivec_vcmpequq( 1823 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 1824 } 1825 1826 static __inline__ vector bool __int128 __ATTRS_o_ai 1827 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1828 return (vector bool __int128)__builtin_altivec_vcmpequq( 1829 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 1830 } 1831 1832 static __inline__ vector bool __int128 __ATTRS_o_ai 1833 vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) { 1834 return (vector bool __int128)__builtin_altivec_vcmpequq( 1835 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 1836 } 1837 #endif 1838 1839 #ifdef __POWER9_VECTOR__ 1840 /* vec_cmpne */ 1841 1842 static __inline__ vector bool char __ATTRS_o_ai 1843 vec_cmpne(vector bool char __a, vector bool char __b) { 1844 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1845 (vector char)__b); 1846 } 1847 1848 static __inline__ vector bool char __ATTRS_o_ai 1849 vec_cmpne(vector signed char __a, vector signed char __b) { 1850 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1851 (vector char)__b); 1852 } 1853 1854 static __inline__ vector bool char __ATTRS_o_ai 1855 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1856 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1857 (vector char)__b); 1858 } 1859 1860 static __inline__ vector bool short __ATTRS_o_ai 1861 vec_cmpne(vector bool short __a, vector bool short __b) { 1862 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1863 (vector short)__b); 1864 } 1865 1866 static __inline__ vector bool short __ATTRS_o_ai 1867 vec_cmpne(vector signed short __a, vector signed short __b) { 1868 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1869 (vector short)__b); 1870 } 1871 1872 static __inline__ vector bool short __ATTRS_o_ai 1873 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1874 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1875 (vector short)__b); 1876 } 1877 1878 static __inline__ vector bool int __ATTRS_o_ai 1879 vec_cmpne(vector bool int __a, vector bool int __b) { 1880 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1881 (vector int)__b); 1882 } 1883 1884 static __inline__ vector bool int __ATTRS_o_ai 1885 vec_cmpne(vector signed int __a, vector signed int __b) { 1886 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1887 (vector int)__b); 1888 } 1889 1890 static __inline__ vector bool int __ATTRS_o_ai 1891 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1892 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1893 (vector int)__b); 1894 } 1895 1896 static __inline__ vector bool int __ATTRS_o_ai 1897 vec_cmpne(vector float __a, vector float __b) { 1898 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1899 (vector int)__b); 1900 } 1901 1902 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1903 static __inline__ vector bool __int128 __ATTRS_o_ai 1904 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1905 return (vector bool __int128)~(__builtin_altivec_vcmpequq( 1906 (vector unsigned __int128)__a, (vector unsigned __int128)__b)); 1907 } 1908 1909 static __inline__ vector bool __int128 __ATTRS_o_ai 1910 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { 1911 return (vector bool __int128)~(__builtin_altivec_vcmpequq( 1912 (vector unsigned __int128)__a, (vector unsigned __int128)__b)); 1913 } 1914 1915 static __inline__ vector bool __int128 __ATTRS_o_ai 1916 vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) { 1917 return (vector bool __int128)~(__builtin_altivec_vcmpequq( 1918 (vector unsigned __int128)__a, (vector unsigned __int128)__b)); 1919 } 1920 #endif 1921 1922 /* vec_cmpnez */ 1923 1924 static __inline__ vector bool char __ATTRS_o_ai 1925 vec_cmpnez(vector signed char __a, vector signed char __b) { 1926 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1927 (vector char)__b); 1928 } 1929 1930 static __inline__ vector bool char __ATTRS_o_ai 1931 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1932 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1933 (vector char)__b); 1934 } 1935 1936 static __inline__ vector bool short __ATTRS_o_ai 1937 vec_cmpnez(vector signed short __a, vector signed short __b) { 1938 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1939 (vector short)__b); 1940 } 1941 1942 static __inline__ vector bool short __ATTRS_o_ai 1943 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1944 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1945 (vector short)__b); 1946 } 1947 1948 static __inline__ vector bool int __ATTRS_o_ai 1949 vec_cmpnez(vector signed int __a, vector signed int __b) { 1950 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1951 (vector int)__b); 1952 } 1953 1954 static __inline__ vector bool int __ATTRS_o_ai 1955 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1956 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1957 (vector int)__b); 1958 } 1959 1960 static __inline__ signed int __ATTRS_o_ai 1961 vec_cntlz_lsbb(vector signed char __a) { 1962 #ifdef __LITTLE_ENDIAN__ 1963 return __builtin_altivec_vctzlsbb((vector unsigned char)__a); 1964 #else 1965 return __builtin_altivec_vclzlsbb((vector unsigned char)__a); 1966 #endif 1967 } 1968 1969 static __inline__ signed int __ATTRS_o_ai 1970 vec_cntlz_lsbb(vector unsigned char __a) { 1971 #ifdef __LITTLE_ENDIAN__ 1972 return __builtin_altivec_vctzlsbb((vector unsigned char)__a); 1973 #else 1974 return __builtin_altivec_vclzlsbb(__a); 1975 #endif 1976 } 1977 1978 static __inline__ signed int __ATTRS_o_ai 1979 vec_cnttz_lsbb(vector signed char __a) { 1980 #ifdef __LITTLE_ENDIAN__ 1981 return __builtin_altivec_vclzlsbb((vector unsigned char)__a); 1982 #else 1983 return __builtin_altivec_vctzlsbb((vector unsigned char)__a); 1984 #endif 1985 } 1986 1987 static __inline__ signed int __ATTRS_o_ai 1988 vec_cnttz_lsbb(vector unsigned char __a) { 1989 #ifdef __LITTLE_ENDIAN__ 1990 return __builtin_altivec_vclzlsbb(__a); 1991 #else 1992 return __builtin_altivec_vctzlsbb(__a); 1993 #endif 1994 } 1995 1996 static __inline__ vector unsigned int __ATTRS_o_ai 1997 vec_parity_lsbb(vector unsigned int __a) { 1998 return __builtin_altivec_vprtybw(__a); 1999 } 2000 2001 static __inline__ vector unsigned int __ATTRS_o_ai 2002 vec_parity_lsbb(vector signed int __a) { 2003 return __builtin_altivec_vprtybw((vector unsigned int)__a); 2004 } 2005 2006 #ifdef __SIZEOF_INT128__ 2007 static __inline__ vector unsigned __int128 __ATTRS_o_ai 2008 vec_parity_lsbb(vector unsigned __int128 __a) { 2009 return __builtin_altivec_vprtybq(__a); 2010 } 2011 2012 static __inline__ vector unsigned __int128 __ATTRS_o_ai 2013 vec_parity_lsbb(vector signed __int128 __a) { 2014 return __builtin_altivec_vprtybq((vector unsigned __int128)__a); 2015 } 2016 #endif 2017 2018 static __inline__ vector unsigned long long __ATTRS_o_ai 2019 vec_parity_lsbb(vector unsigned long long __a) { 2020 return __builtin_altivec_vprtybd(__a); 2021 } 2022 2023 static __inline__ vector unsigned long long __ATTRS_o_ai 2024 vec_parity_lsbb(vector signed long long __a) { 2025 return __builtin_altivec_vprtybd((vector unsigned long long)__a); 2026 } 2027 2028 #else 2029 /* vec_cmpne */ 2030 2031 static __inline__ vector bool char __ATTRS_o_ai 2032 vec_cmpne(vector bool char __a, vector bool char __b) { 2033 return ~(vec_cmpeq(__a, __b)); 2034 } 2035 2036 static __inline__ vector bool char __ATTRS_o_ai 2037 vec_cmpne(vector signed char __a, vector signed char __b) { 2038 return ~(vec_cmpeq(__a, __b)); 2039 } 2040 2041 static __inline__ vector bool char __ATTRS_o_ai 2042 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 2043 return ~(vec_cmpeq(__a, __b)); 2044 } 2045 2046 static __inline__ vector bool short __ATTRS_o_ai 2047 vec_cmpne(vector bool short __a, vector bool short __b) { 2048 return ~(vec_cmpeq(__a, __b)); 2049 } 2050 2051 static __inline__ vector bool short __ATTRS_o_ai 2052 vec_cmpne(vector signed short __a, vector signed short __b) { 2053 return ~(vec_cmpeq(__a, __b)); 2054 } 2055 2056 static __inline__ vector bool short __ATTRS_o_ai 2057 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 2058 return ~(vec_cmpeq(__a, __b)); 2059 } 2060 2061 static __inline__ vector bool int __ATTRS_o_ai 2062 vec_cmpne(vector bool int __a, vector bool int __b) { 2063 return ~(vec_cmpeq(__a, __b)); 2064 } 2065 2066 static __inline__ vector bool int __ATTRS_o_ai 2067 vec_cmpne(vector signed int __a, vector signed int __b) { 2068 return ~(vec_cmpeq(__a, __b)); 2069 } 2070 2071 static __inline__ vector bool int __ATTRS_o_ai 2072 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 2073 return ~(vec_cmpeq(__a, __b)); 2074 } 2075 2076 static __inline__ vector bool int __ATTRS_o_ai 2077 vec_cmpne(vector float __a, vector float __b) { 2078 return ~(vec_cmpeq(__a, __b)); 2079 } 2080 #endif 2081 2082 #ifdef __POWER8_VECTOR__ 2083 static __inline__ vector bool long long __ATTRS_o_ai 2084 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2085 return (vector bool long long) 2086 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2087 } 2088 2089 static __inline__ vector bool long long __ATTRS_o_ai 2090 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2091 return (vector bool long long) 2092 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2093 } 2094 2095 static __inline__ vector bool long long __ATTRS_o_ai 2096 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2097 return (vector bool long long) 2098 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2099 } 2100 #elif defined(__VSX__) 2101 static __inline__ vector bool long long __ATTRS_o_ai 2102 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2103 return (vector bool long long)~( 2104 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2105 } 2106 2107 static __inline__ vector bool long long __ATTRS_o_ai 2108 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2109 return (vector bool long long)~( 2110 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2111 } 2112 2113 static __inline__ vector bool long long __ATTRS_o_ai 2114 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2115 return (vector bool long long)~( 2116 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2117 } 2118 #endif 2119 2120 #ifdef __VSX__ 2121 static __inline__ vector bool long long __ATTRS_o_ai 2122 vec_cmpne(vector double __a, vector double __b) { 2123 return (vector bool long long) 2124 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2125 } 2126 #endif 2127 2128 /* vec_cmpgt */ 2129 2130 static __inline__ vector bool char __ATTRS_o_ai 2131 vec_cmpgt(vector signed char __a, vector signed char __b) { 2132 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2133 } 2134 2135 static __inline__ vector bool char __ATTRS_o_ai 2136 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 2137 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2138 } 2139 2140 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 2141 vector short __b) { 2142 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2143 } 2144 2145 static __inline__ vector bool short __ATTRS_o_ai 2146 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 2147 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2148 } 2149 2150 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 2151 vector int __b) { 2152 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2153 } 2154 2155 static __inline__ vector bool int __ATTRS_o_ai 2156 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 2157 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2158 } 2159 2160 #ifdef __POWER8_VECTOR__ 2161 static __inline__ vector bool long long __ATTRS_o_ai 2162 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2163 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 2164 } 2165 2166 static __inline__ vector bool long long __ATTRS_o_ai 2167 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2168 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2169 } 2170 #elif defined(__VSX__) 2171 static __inline__ vector bool long long __ATTRS_o_ai 2172 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2173 vector signed int __sgtw = (vector signed int)vec_cmpgt( 2174 (vector signed int)__a, (vector signed int)__b); 2175 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2176 (vector unsigned int)__a, (vector unsigned int)__b); 2177 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2178 (vector signed int)__a, (vector signed int)__b); 2179 #ifdef __LITTLE_ENDIAN__ 2180 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2181 __sgtw |= (vector signed int)__ugtw; 2182 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, 2183 3); 2184 #else 2185 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2186 __sgtw |= (vector signed int)__ugtw; 2187 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, 2188 2); 2189 #endif 2190 } 2191 2192 static __inline__ vector bool long long __ATTRS_o_ai 2193 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2194 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2195 (vector unsigned int)__a, (vector unsigned int)__b); 2196 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2197 (vector signed int)__a, (vector signed int)__b); 2198 #ifdef __LITTLE_ENDIAN__ 2199 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2200 __ugtw |= __eqw; 2201 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, 2202 3); 2203 #else 2204 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2205 __ugtw |= __eqw; 2206 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, 2207 2); 2208 #endif 2209 } 2210 #endif 2211 2212 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2213 vector float __b) { 2214 #ifdef __VSX__ 2215 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2216 #else 2217 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2218 #endif 2219 } 2220 2221 #ifdef __VSX__ 2222 static __inline__ vector bool long long __ATTRS_o_ai 2223 vec_cmpgt(vector double __a, vector double __b) { 2224 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2225 } 2226 #endif 2227 2228 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2229 static __inline__ vector bool __int128 __ATTRS_o_ai 2230 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { 2231 return (vector bool __int128)__builtin_altivec_vcmpgtsq(__a, __b); 2232 } 2233 2234 static __inline__ vector bool __int128 __ATTRS_o_ai 2235 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2236 return (vector bool __int128)__builtin_altivec_vcmpgtuq(__a, __b); 2237 } 2238 #endif 2239 2240 /* vec_cmpge */ 2241 2242 static __inline__ vector bool char __ATTRS_o_ai 2243 vec_cmpge(vector signed char __a, vector signed char __b) { 2244 return ~(vec_cmpgt(__b, __a)); 2245 } 2246 2247 static __inline__ vector bool char __ATTRS_o_ai 2248 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2249 return ~(vec_cmpgt(__b, __a)); 2250 } 2251 2252 static __inline__ vector bool short __ATTRS_o_ai 2253 vec_cmpge(vector signed short __a, vector signed short __b) { 2254 return ~(vec_cmpgt(__b, __a)); 2255 } 2256 2257 static __inline__ vector bool short __ATTRS_o_ai 2258 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2259 return ~(vec_cmpgt(__b, __a)); 2260 } 2261 2262 static __inline__ vector bool int __ATTRS_o_ai 2263 vec_cmpge(vector signed int __a, vector signed int __b) { 2264 return ~(vec_cmpgt(__b, __a)); 2265 } 2266 2267 static __inline__ vector bool int __ATTRS_o_ai 2268 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2269 return ~(vec_cmpgt(__b, __a)); 2270 } 2271 2272 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2273 vector float __b) { 2274 #ifdef __VSX__ 2275 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2276 #else 2277 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2278 #endif 2279 } 2280 2281 #ifdef __VSX__ 2282 static __inline__ vector bool long long __ATTRS_o_ai 2283 vec_cmpge(vector double __a, vector double __b) { 2284 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2285 } 2286 2287 static __inline__ vector bool long long __ATTRS_o_ai 2288 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2289 return ~(vec_cmpgt(__b, __a)); 2290 } 2291 2292 static __inline__ vector bool long long __ATTRS_o_ai 2293 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2294 return ~(vec_cmpgt(__b, __a)); 2295 } 2296 #endif 2297 2298 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2299 static __inline__ vector bool __int128 __ATTRS_o_ai 2300 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { 2301 return ~(vec_cmpgt(__b, __a)); 2302 } 2303 2304 static __inline__ vector bool __int128 __ATTRS_o_ai 2305 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2306 return ~(vec_cmpgt(__b, __a)); 2307 } 2308 #endif 2309 2310 /* vec_vcmpgefp */ 2311 2312 static __inline__ vector bool int __attribute__((__always_inline__)) 2313 vec_vcmpgefp(vector float __a, vector float __b) { 2314 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2315 } 2316 2317 /* vec_vcmpgtsb */ 2318 2319 static __inline__ vector bool char __attribute__((__always_inline__)) 2320 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2321 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2322 } 2323 2324 /* vec_vcmpgtub */ 2325 2326 static __inline__ vector bool char __attribute__((__always_inline__)) 2327 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2328 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2329 } 2330 2331 /* vec_vcmpgtsh */ 2332 2333 static __inline__ vector bool short __attribute__((__always_inline__)) 2334 vec_vcmpgtsh(vector short __a, vector short __b) { 2335 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2336 } 2337 2338 /* vec_vcmpgtuh */ 2339 2340 static __inline__ vector bool short __attribute__((__always_inline__)) 2341 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2342 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2343 } 2344 2345 /* vec_vcmpgtsw */ 2346 2347 static __inline__ vector bool int __attribute__((__always_inline__)) 2348 vec_vcmpgtsw(vector int __a, vector int __b) { 2349 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2350 } 2351 2352 /* vec_vcmpgtuw */ 2353 2354 static __inline__ vector bool int __attribute__((__always_inline__)) 2355 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2356 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2357 } 2358 2359 /* vec_vcmpgtfp */ 2360 2361 static __inline__ vector bool int __attribute__((__always_inline__)) 2362 vec_vcmpgtfp(vector float __a, vector float __b) { 2363 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2364 } 2365 2366 /* vec_cmple */ 2367 2368 static __inline__ vector bool char __ATTRS_o_ai 2369 vec_cmple(vector signed char __a, vector signed char __b) { 2370 return vec_cmpge(__b, __a); 2371 } 2372 2373 static __inline__ vector bool char __ATTRS_o_ai 2374 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2375 return vec_cmpge(__b, __a); 2376 } 2377 2378 static __inline__ vector bool short __ATTRS_o_ai 2379 vec_cmple(vector signed short __a, vector signed short __b) { 2380 return vec_cmpge(__b, __a); 2381 } 2382 2383 static __inline__ vector bool short __ATTRS_o_ai 2384 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2385 return vec_cmpge(__b, __a); 2386 } 2387 2388 static __inline__ vector bool int __ATTRS_o_ai 2389 vec_cmple(vector signed int __a, vector signed int __b) { 2390 return vec_cmpge(__b, __a); 2391 } 2392 2393 static __inline__ vector bool int __ATTRS_o_ai 2394 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2395 return vec_cmpge(__b, __a); 2396 } 2397 2398 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2399 vector float __b) { 2400 return vec_cmpge(__b, __a); 2401 } 2402 2403 #ifdef __VSX__ 2404 static __inline__ vector bool long long __ATTRS_o_ai 2405 vec_cmple(vector double __a, vector double __b) { 2406 return vec_cmpge(__b, __a); 2407 } 2408 2409 static __inline__ vector bool long long __ATTRS_o_ai 2410 vec_cmple(vector signed long long __a, vector signed long long __b) { 2411 return vec_cmpge(__b, __a); 2412 } 2413 2414 static __inline__ vector bool long long __ATTRS_o_ai 2415 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2416 return vec_cmpge(__b, __a); 2417 } 2418 #endif 2419 2420 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2421 static __inline__ vector bool __int128 __ATTRS_o_ai 2422 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { 2423 return vec_cmpge(__b, __a); 2424 } 2425 2426 static __inline__ vector bool __int128 __ATTRS_o_ai 2427 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2428 return vec_cmpge(__b, __a); 2429 } 2430 #endif 2431 2432 /* vec_cmplt */ 2433 2434 static __inline__ vector bool char __ATTRS_o_ai 2435 vec_cmplt(vector signed char __a, vector signed char __b) { 2436 return vec_cmpgt(__b, __a); 2437 } 2438 2439 static __inline__ vector bool char __ATTRS_o_ai 2440 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2441 return vec_cmpgt(__b, __a); 2442 } 2443 2444 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2445 vector short __b) { 2446 return vec_cmpgt(__b, __a); 2447 } 2448 2449 static __inline__ vector bool short __ATTRS_o_ai 2450 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2451 return vec_cmpgt(__b, __a); 2452 } 2453 2454 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2455 vector int __b) { 2456 return vec_cmpgt(__b, __a); 2457 } 2458 2459 static __inline__ vector bool int __ATTRS_o_ai 2460 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2461 return vec_cmpgt(__b, __a); 2462 } 2463 2464 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2465 vector float __b) { 2466 return vec_cmpgt(__b, __a); 2467 } 2468 2469 #ifdef __VSX__ 2470 static __inline__ vector bool long long __ATTRS_o_ai 2471 vec_cmplt(vector double __a, vector double __b) { 2472 return vec_cmpgt(__b, __a); 2473 } 2474 #endif 2475 2476 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2477 static __inline__ vector bool __int128 __ATTRS_o_ai 2478 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { 2479 return vec_cmpgt(__b, __a); 2480 } 2481 2482 static __inline__ vector bool __int128 __ATTRS_o_ai 2483 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2484 return vec_cmpgt(__b, __a); 2485 } 2486 #endif 2487 2488 #ifdef __VSX__ 2489 static __inline__ vector bool long long __ATTRS_o_ai 2490 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2491 return vec_cmpgt(__b, __a); 2492 } 2493 2494 static __inline__ vector bool long long __ATTRS_o_ai 2495 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2496 return vec_cmpgt(__b, __a); 2497 } 2498 #endif 2499 2500 #ifdef __POWER8_VECTOR__ 2501 /* vec_popcnt */ 2502 2503 static __inline__ vector unsigned char __ATTRS_o_ai 2504 vec_popcnt(vector signed char __a) { 2505 return (vector unsigned char)__builtin_altivec_vpopcntb( 2506 (vector unsigned char)__a); 2507 } 2508 static __inline__ vector unsigned char __ATTRS_o_ai 2509 vec_popcnt(vector unsigned char __a) { 2510 return __builtin_altivec_vpopcntb(__a); 2511 } 2512 static __inline__ vector unsigned short __ATTRS_o_ai 2513 vec_popcnt(vector signed short __a) { 2514 return (vector unsigned short)__builtin_altivec_vpopcnth( 2515 (vector unsigned short)__a); 2516 } 2517 static __inline__ vector unsigned short __ATTRS_o_ai 2518 vec_popcnt(vector unsigned short __a) { 2519 return __builtin_altivec_vpopcnth(__a); 2520 } 2521 static __inline__ vector unsigned int __ATTRS_o_ai 2522 vec_popcnt(vector signed int __a) { 2523 return __builtin_altivec_vpopcntw((vector unsigned int)__a); 2524 } 2525 static __inline__ vector unsigned int __ATTRS_o_ai 2526 vec_popcnt(vector unsigned int __a) { 2527 return __builtin_altivec_vpopcntw(__a); 2528 } 2529 static __inline__ vector unsigned long long __ATTRS_o_ai 2530 vec_popcnt(vector signed long long __a) { 2531 return __builtin_altivec_vpopcntd((vector unsigned long long)__a); 2532 } 2533 static __inline__ vector unsigned long long __ATTRS_o_ai 2534 vec_popcnt(vector unsigned long long __a) { 2535 return __builtin_altivec_vpopcntd(__a); 2536 } 2537 2538 #define vec_vclz vec_cntlz 2539 /* vec_cntlz */ 2540 2541 static __inline__ vector signed char __ATTRS_o_ai 2542 vec_cntlz(vector signed char __a) { 2543 return (vector signed char)__builtin_altivec_vclzb((vector unsigned char)__a); 2544 } 2545 static __inline__ vector unsigned char __ATTRS_o_ai 2546 vec_cntlz(vector unsigned char __a) { 2547 return __builtin_altivec_vclzb(__a); 2548 } 2549 static __inline__ vector signed short __ATTRS_o_ai 2550 vec_cntlz(vector signed short __a) { 2551 return (vector signed short)__builtin_altivec_vclzh( 2552 (vector unsigned short)__a); 2553 } 2554 static __inline__ vector unsigned short __ATTRS_o_ai 2555 vec_cntlz(vector unsigned short __a) { 2556 return __builtin_altivec_vclzh(__a); 2557 } 2558 static __inline__ vector signed int __ATTRS_o_ai 2559 vec_cntlz(vector signed int __a) { 2560 return (vector signed int)__builtin_altivec_vclzw((vector unsigned int)__a); 2561 } 2562 static __inline__ vector unsigned int __ATTRS_o_ai 2563 vec_cntlz(vector unsigned int __a) { 2564 return __builtin_altivec_vclzw(__a); 2565 } 2566 static __inline__ vector signed long long __ATTRS_o_ai 2567 vec_cntlz(vector signed long long __a) { 2568 return (vector signed long long)__builtin_altivec_vclzd( 2569 (vector unsigned long long)__a); 2570 } 2571 static __inline__ vector unsigned long long __ATTRS_o_ai 2572 vec_cntlz(vector unsigned long long __a) { 2573 return __builtin_altivec_vclzd(__a); 2574 } 2575 #endif 2576 2577 #ifdef __POWER9_VECTOR__ 2578 2579 /* vec_cnttz */ 2580 2581 static __inline__ vector signed char __ATTRS_o_ai 2582 vec_cnttz(vector signed char __a) { 2583 return (vector signed char)__builtin_altivec_vctzb((vector unsigned char)__a); 2584 } 2585 static __inline__ vector unsigned char __ATTRS_o_ai 2586 vec_cnttz(vector unsigned char __a) { 2587 return __builtin_altivec_vctzb(__a); 2588 } 2589 static __inline__ vector signed short __ATTRS_o_ai 2590 vec_cnttz(vector signed short __a) { 2591 return (vector signed short)__builtin_altivec_vctzh( 2592 (vector unsigned short)__a); 2593 } 2594 static __inline__ vector unsigned short __ATTRS_o_ai 2595 vec_cnttz(vector unsigned short __a) { 2596 return __builtin_altivec_vctzh(__a); 2597 } 2598 static __inline__ vector signed int __ATTRS_o_ai 2599 vec_cnttz(vector signed int __a) { 2600 return (vector signed int)__builtin_altivec_vctzw((vector unsigned int)__a); 2601 } 2602 static __inline__ vector unsigned int __ATTRS_o_ai 2603 vec_cnttz(vector unsigned int __a) { 2604 return __builtin_altivec_vctzw(__a); 2605 } 2606 static __inline__ vector signed long long __ATTRS_o_ai 2607 vec_cnttz(vector signed long long __a) { 2608 return (vector signed long long)__builtin_altivec_vctzd( 2609 (vector unsigned long long)__a); 2610 } 2611 static __inline__ vector unsigned long long __ATTRS_o_ai 2612 vec_cnttz(vector unsigned long long __a) { 2613 return __builtin_altivec_vctzd(__a); 2614 } 2615 2616 /* vec_first_match_index */ 2617 2618 static __inline__ unsigned __ATTRS_o_ai 2619 vec_first_match_index(vector signed char __a, vector signed char __b) { 2620 vector unsigned long long __res = 2621 #ifdef __LITTLE_ENDIAN__ 2622 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2623 #else 2624 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2625 #endif 2626 if (__res[0] == 64) { 2627 return (__res[1] + 64) >> 3; 2628 } 2629 return __res[0] >> 3; 2630 } 2631 2632 static __inline__ unsigned __ATTRS_o_ai 2633 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2634 vector unsigned long long __res = 2635 #ifdef __LITTLE_ENDIAN__ 2636 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2637 #else 2638 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2639 #endif 2640 if (__res[0] == 64) { 2641 return (__res[1] + 64) >> 3; 2642 } 2643 return __res[0] >> 3; 2644 } 2645 2646 static __inline__ unsigned __ATTRS_o_ai 2647 vec_first_match_index(vector signed short __a, vector signed short __b) { 2648 vector unsigned long long __res = 2649 #ifdef __LITTLE_ENDIAN__ 2650 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2651 #else 2652 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2653 #endif 2654 if (__res[0] == 64) { 2655 return (__res[1] + 64) >> 4; 2656 } 2657 return __res[0] >> 4; 2658 } 2659 2660 static __inline__ unsigned __ATTRS_o_ai 2661 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2662 vector unsigned long long __res = 2663 #ifdef __LITTLE_ENDIAN__ 2664 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2665 #else 2666 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2667 #endif 2668 if (__res[0] == 64) { 2669 return (__res[1] + 64) >> 4; 2670 } 2671 return __res[0] >> 4; 2672 } 2673 2674 static __inline__ unsigned __ATTRS_o_ai 2675 vec_first_match_index(vector signed int __a, vector signed int __b) { 2676 vector unsigned long long __res = 2677 #ifdef __LITTLE_ENDIAN__ 2678 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2679 #else 2680 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2681 #endif 2682 if (__res[0] == 64) { 2683 return (__res[1] + 64) >> 5; 2684 } 2685 return __res[0] >> 5; 2686 } 2687 2688 static __inline__ unsigned __ATTRS_o_ai 2689 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2690 vector unsigned long long __res = 2691 #ifdef __LITTLE_ENDIAN__ 2692 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2693 #else 2694 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2695 #endif 2696 if (__res[0] == 64) { 2697 return (__res[1] + 64) >> 5; 2698 } 2699 return __res[0] >> 5; 2700 } 2701 2702 /* vec_first_match_or_eos_index */ 2703 2704 static __inline__ unsigned __ATTRS_o_ai 2705 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2706 /* Compare the result of the comparison of two vectors with either and OR the 2707 result. Either the elements are equal or one will equal the comparison 2708 result if either is zero. 2709 */ 2710 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2711 vector bool char __tmp2 = __tmp1 | 2712 vec_cmpeq((vector signed char)__tmp1, __a) | 2713 vec_cmpeq((vector signed char)__tmp1, __b); 2714 2715 vector unsigned long long __res = 2716 #ifdef __LITTLE_ENDIAN__ 2717 vec_cnttz((vector unsigned long long)__tmp2); 2718 #else 2719 vec_cntlz((vector unsigned long long)__tmp2); 2720 #endif 2721 if (__res[0] == 64) { 2722 return (__res[1] + 64) >> 3; 2723 } 2724 return __res[0] >> 3; 2725 } 2726 2727 static __inline__ unsigned __ATTRS_o_ai 2728 vec_first_match_or_eos_index(vector unsigned char __a, 2729 vector unsigned char __b) { 2730 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2731 vector bool char __tmp2 = __tmp1 | 2732 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2733 vec_cmpeq((vector unsigned char)__tmp1, __b); 2734 2735 vector unsigned long long __res = 2736 #ifdef __LITTLE_ENDIAN__ 2737 vec_cnttz((vector unsigned long long)__tmp2); 2738 #else 2739 vec_cntlz((vector unsigned long long)__tmp2); 2740 #endif 2741 if (__res[0] == 64) { 2742 return (__res[1] + 64) >> 3; 2743 } 2744 return __res[0] >> 3; 2745 } 2746 2747 static __inline__ unsigned __ATTRS_o_ai 2748 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2749 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2750 vector bool short __tmp2 = __tmp1 | 2751 vec_cmpeq((vector signed short)__tmp1, __a) | 2752 vec_cmpeq((vector signed short)__tmp1, __b); 2753 2754 vector unsigned long long __res = 2755 #ifdef __LITTLE_ENDIAN__ 2756 vec_cnttz((vector unsigned long long)__tmp2); 2757 #else 2758 vec_cntlz((vector unsigned long long)__tmp2); 2759 #endif 2760 if (__res[0] == 64) { 2761 return (__res[1] + 64) >> 4; 2762 } 2763 return __res[0] >> 4; 2764 } 2765 2766 static __inline__ unsigned __ATTRS_o_ai 2767 vec_first_match_or_eos_index(vector unsigned short __a, 2768 vector unsigned short __b) { 2769 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2770 vector bool short __tmp2 = __tmp1 | 2771 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2772 vec_cmpeq((vector unsigned short)__tmp1, __b); 2773 2774 vector unsigned long long __res = 2775 #ifdef __LITTLE_ENDIAN__ 2776 vec_cnttz((vector unsigned long long)__tmp2); 2777 #else 2778 vec_cntlz((vector unsigned long long)__tmp2); 2779 #endif 2780 if (__res[0] == 64) { 2781 return (__res[1] + 64) >> 4; 2782 } 2783 return __res[0] >> 4; 2784 } 2785 2786 static __inline__ unsigned __ATTRS_o_ai 2787 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2788 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2789 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2790 vec_cmpeq((vector signed int)__tmp1, __b); 2791 2792 vector unsigned long long __res = 2793 #ifdef __LITTLE_ENDIAN__ 2794 vec_cnttz((vector unsigned long long)__tmp2); 2795 #else 2796 vec_cntlz((vector unsigned long long)__tmp2); 2797 #endif 2798 if (__res[0] == 64) { 2799 return (__res[1] + 64) >> 5; 2800 } 2801 return __res[0] >> 5; 2802 } 2803 2804 static __inline__ unsigned __ATTRS_o_ai 2805 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2806 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2807 vector bool int __tmp2 = __tmp1 | 2808 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2809 vec_cmpeq((vector unsigned int)__tmp1, __b); 2810 2811 vector unsigned long long __res = 2812 #ifdef __LITTLE_ENDIAN__ 2813 vec_cnttz((vector unsigned long long)__tmp2); 2814 #else 2815 vec_cntlz((vector unsigned long long)__tmp2); 2816 #endif 2817 if (__res[0] == 64) { 2818 return (__res[1] + 64) >> 5; 2819 } 2820 return __res[0] >> 5; 2821 } 2822 2823 /* vec_first_mismatch_index */ 2824 2825 static __inline__ unsigned __ATTRS_o_ai 2826 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2827 vector unsigned long long __res = 2828 #ifdef __LITTLE_ENDIAN__ 2829 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2830 #else 2831 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2832 #endif 2833 if (__res[0] == 64) { 2834 return (__res[1] + 64) >> 3; 2835 } 2836 return __res[0] >> 3; 2837 } 2838 2839 static __inline__ unsigned __ATTRS_o_ai 2840 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2841 vector unsigned long long __res = 2842 #ifdef __LITTLE_ENDIAN__ 2843 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2844 #else 2845 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2846 #endif 2847 if (__res[0] == 64) { 2848 return (__res[1] + 64) >> 3; 2849 } 2850 return __res[0] >> 3; 2851 } 2852 2853 static __inline__ unsigned __ATTRS_o_ai 2854 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2855 vector unsigned long long __res = 2856 #ifdef __LITTLE_ENDIAN__ 2857 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2858 #else 2859 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2860 #endif 2861 if (__res[0] == 64) { 2862 return (__res[1] + 64) >> 4; 2863 } 2864 return __res[0] >> 4; 2865 } 2866 2867 static __inline__ unsigned __ATTRS_o_ai 2868 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2869 vector unsigned long long __res = 2870 #ifdef __LITTLE_ENDIAN__ 2871 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2872 #else 2873 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2874 #endif 2875 if (__res[0] == 64) { 2876 return (__res[1] + 64) >> 4; 2877 } 2878 return __res[0] >> 4; 2879 } 2880 2881 static __inline__ unsigned __ATTRS_o_ai 2882 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2883 vector unsigned long long __res = 2884 #ifdef __LITTLE_ENDIAN__ 2885 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2886 #else 2887 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2888 #endif 2889 if (__res[0] == 64) { 2890 return (__res[1] + 64) >> 5; 2891 } 2892 return __res[0] >> 5; 2893 } 2894 2895 static __inline__ unsigned __ATTRS_o_ai 2896 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2897 vector unsigned long long __res = 2898 #ifdef __LITTLE_ENDIAN__ 2899 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2900 #else 2901 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2902 #endif 2903 if (__res[0] == 64) { 2904 return (__res[1] + 64) >> 5; 2905 } 2906 return __res[0] >> 5; 2907 } 2908 2909 /* vec_first_mismatch_or_eos_index */ 2910 2911 static __inline__ unsigned __ATTRS_o_ai 2912 vec_first_mismatch_or_eos_index(vector signed char __a, 2913 vector signed char __b) { 2914 vector unsigned long long __res = 2915 #ifdef __LITTLE_ENDIAN__ 2916 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2917 #else 2918 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2919 #endif 2920 if (__res[0] == 64) { 2921 return (__res[1] + 64) >> 3; 2922 } 2923 return __res[0] >> 3; 2924 } 2925 2926 static __inline__ unsigned __ATTRS_o_ai 2927 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2928 vector unsigned char __b) { 2929 vector unsigned long long __res = 2930 #ifdef __LITTLE_ENDIAN__ 2931 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2932 #else 2933 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2934 #endif 2935 if (__res[0] == 64) { 2936 return (__res[1] + 64) >> 3; 2937 } 2938 return __res[0] >> 3; 2939 } 2940 2941 static __inline__ unsigned __ATTRS_o_ai 2942 vec_first_mismatch_or_eos_index(vector signed short __a, 2943 vector signed short __b) { 2944 vector unsigned long long __res = 2945 #ifdef __LITTLE_ENDIAN__ 2946 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2947 #else 2948 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2949 #endif 2950 if (__res[0] == 64) { 2951 return (__res[1] + 64) >> 4; 2952 } 2953 return __res[0] >> 4; 2954 } 2955 2956 static __inline__ unsigned __ATTRS_o_ai 2957 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2958 vector unsigned short __b) { 2959 vector unsigned long long __res = 2960 #ifdef __LITTLE_ENDIAN__ 2961 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2962 #else 2963 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2964 #endif 2965 if (__res[0] == 64) { 2966 return (__res[1] + 64) >> 4; 2967 } 2968 return __res[0] >> 4; 2969 } 2970 2971 static __inline__ unsigned __ATTRS_o_ai 2972 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2973 vector unsigned long long __res = 2974 #ifdef __LITTLE_ENDIAN__ 2975 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2976 #else 2977 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2978 #endif 2979 if (__res[0] == 64) { 2980 return (__res[1] + 64) >> 5; 2981 } 2982 return __res[0] >> 5; 2983 } 2984 2985 static __inline__ unsigned __ATTRS_o_ai 2986 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2987 vector unsigned int __b) { 2988 vector unsigned long long __res = 2989 #ifdef __LITTLE_ENDIAN__ 2990 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2991 #else 2992 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2993 #endif 2994 if (__res[0] == 64) { 2995 return (__res[1] + 64) >> 5; 2996 } 2997 return __res[0] >> 5; 2998 } 2999 3000 static __inline__ vector double __ATTRS_o_ai 3001 vec_insert_exp(vector double __a, vector unsigned long long __b) { 3002 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 3003 } 3004 3005 static __inline__ vector double __ATTRS_o_ai 3006 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 3007 return __builtin_vsx_xviexpdp(__a,__b); 3008 } 3009 3010 static __inline__ vector float __ATTRS_o_ai 3011 vec_insert_exp(vector float __a, vector unsigned int __b) { 3012 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 3013 } 3014 3015 static __inline__ vector float __ATTRS_o_ai 3016 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 3017 return __builtin_vsx_xviexpsp(__a,__b); 3018 } 3019 3020 #if defined(__powerpc64__) 3021 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 3022 size_t __b) { 3023 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 3024 } 3025 3026 static __inline__ vector unsigned char __ATTRS_o_ai 3027 vec_xl_len(const unsigned char *__a, size_t __b) { 3028 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 3029 } 3030 3031 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 3032 size_t __b) { 3033 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 3034 } 3035 3036 static __inline__ vector unsigned short __ATTRS_o_ai 3037 vec_xl_len(const unsigned short *__a, size_t __b) { 3038 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 3039 } 3040 3041 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 3042 size_t __b) { 3043 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 3044 } 3045 3046 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 3047 size_t __b) { 3048 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 3049 } 3050 3051 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 3052 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 3053 } 3054 3055 #ifdef __SIZEOF_INT128__ 3056 static __inline__ vector signed __int128 __ATTRS_o_ai 3057 vec_xl_len(const signed __int128 *__a, size_t __b) { 3058 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3059 } 3060 3061 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3062 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 3063 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3064 } 3065 #endif 3066 3067 static __inline__ vector signed long long __ATTRS_o_ai 3068 vec_xl_len(const signed long long *__a, size_t __b) { 3069 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3070 } 3071 3072 static __inline__ vector unsigned long long __ATTRS_o_ai 3073 vec_xl_len(const unsigned long long *__a, size_t __b) { 3074 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3075 } 3076 3077 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 3078 size_t __b) { 3079 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 3080 } 3081 3082 static __inline__ vector unsigned char __ATTRS_o_ai 3083 vec_xl_len_r(const unsigned char *__a, size_t __b) { 3084 vector unsigned char __res = 3085 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 3086 vector unsigned char __mask = 3087 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 3088 return (vector unsigned char)__builtin_altivec_vperm_4si( 3089 (vector int)__res, (vector int)__res, __mask); 3090 } 3091 3092 // vec_xst_len 3093 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 3094 unsigned char *__b, 3095 size_t __c) { 3096 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3097 } 3098 3099 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, 3100 signed char *__b, size_t __c) { 3101 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3102 } 3103 3104 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a, 3105 signed short *__b, size_t __c) { 3106 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3107 } 3108 3109 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, 3110 unsigned short *__b, 3111 size_t __c) { 3112 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3113 } 3114 3115 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 3116 signed int *__b, size_t __c) { 3117 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3118 } 3119 3120 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, 3121 unsigned int *__b, size_t __c) { 3122 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3123 } 3124 3125 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, 3126 size_t __c) { 3127 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3128 } 3129 3130 #ifdef __SIZEOF_INT128__ 3131 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 3132 signed __int128 *__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(vector unsigned __int128 __a, 3138 unsigned __int128 *__b, 3139 size_t __c) { 3140 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3141 } 3142 #endif 3143 3144 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 3145 signed long long *__b, 3146 size_t __c) { 3147 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3148 } 3149 3150 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 3151 unsigned long long *__b, 3152 size_t __c) { 3153 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3154 } 3155 3156 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, 3157 size_t __c) { 3158 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3159 } 3160 3161 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, 3162 unsigned char *__b, 3163 size_t __c) { 3164 vector unsigned char __mask = 3165 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 3166 vector unsigned char __res = 3167 (vector unsigned char)__builtin_altivec_vperm_4si( 3168 (vector int)__a, (vector int)__a, __mask); 3169 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 3170 } 3171 #endif 3172 #endif 3173 3174 #if defined(__POWER9_VECTOR__) && defined(__powerpc64__) 3175 #define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT)) 3176 #define __vec_strmb(PTR, CNT, VAL) \ 3177 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT)) 3178 #else 3179 #define __vec_ldrmb __builtin_vsx_ldrmb 3180 #define __vec_strmb __builtin_vsx_strmb 3181 #endif 3182 3183 /* vec_cpsgn */ 3184 3185 #ifdef __VSX__ 3186 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 3187 vector float __b) { 3188 return __builtin_vsx_xvcpsgnsp(__b, __a); 3189 } 3190 3191 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 3192 vector double __b) { 3193 return __builtin_vsx_xvcpsgndp(__b, __a); 3194 } 3195 #endif 3196 3197 /* vec_ctf */ 3198 3199 #ifdef __VSX__ 3200 // There are some functions that have different signatures with the XL compiler 3201 // from those in Clang/GCC and documented in the PVIPR. This macro ensures that 3202 // the XL-compatible signatures are used for those functions. 3203 #ifdef __XL_COMPAT_ALTIVEC__ 3204 #define vec_ctf(__a, __b) \ 3205 _Generic( \ 3206 (__a), vector int \ 3207 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3208 vector unsigned int \ 3209 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3210 (__b)), \ 3211 vector unsigned long long \ 3212 : (vector float)(__builtin_vsx_xvcvuxdsp( \ 3213 (vector unsigned long long)(__a)) * \ 3214 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \ 3215 vector signed long long \ 3216 : (vector float)(__builtin_vsx_xvcvsxdsp( \ 3217 (vector signed long long)(__a)) * \ 3218 (vector float)(vector unsigned)((0x7f - (__b)) << 23))) 3219 #else // __XL_COMPAT_ALTIVEC__ 3220 #define vec_ctf(__a, __b) \ 3221 _Generic( \ 3222 (__a), vector int \ 3223 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3224 vector unsigned int \ 3225 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3226 (__b)), \ 3227 vector unsigned long long \ 3228 : (vector float)(__builtin_convertvector( \ 3229 (vector unsigned long long)(__a), vector double) * \ 3230 (vector double)(vector unsigned long long)((0x3ffULL - \ 3231 (__b)) \ 3232 << 52)), \ 3233 vector signed long long \ 3234 : (vector float)(__builtin_convertvector((vector signed long long)(__a), \ 3235 vector double) * \ 3236 (vector double)(vector unsigned long long)((0x3ffULL - \ 3237 (__b)) \ 3238 << 52))) 3239 #endif // __XL_COMPAT_ALTIVEC__ 3240 #else 3241 #define vec_ctf(__a, __b) \ 3242 _Generic((__a), vector int \ 3243 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3244 vector unsigned int \ 3245 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3246 (__b))) 3247 #endif 3248 3249 /* vec_ctd */ 3250 #ifdef __VSX__ 3251 #define vec_ctd(__a, __b) \ 3252 _Generic((__a), vector signed int \ 3253 : (vec_doublee((vector signed int)(__a)) * \ 3254 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3255 << 52)), \ 3256 vector unsigned int \ 3257 : (vec_doublee((vector unsigned int)(__a)) * \ 3258 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3259 << 52)), \ 3260 vector unsigned long long \ 3261 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3262 vector double) * \ 3263 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3264 << 52)), \ 3265 vector signed long long \ 3266 : (__builtin_convertvector((vector signed long long)(__a), \ 3267 vector double) * \ 3268 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3269 << 52))) 3270 #endif // __VSX__ 3271 3272 /* vec_vcfsx */ 3273 3274 #define vec_vcfux __builtin_altivec_vcfux 3275 /* vec_vcfux */ 3276 3277 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 3278 3279 /* vec_cts */ 3280 3281 #ifdef __VSX__ 3282 #ifdef __XL_COMPAT_ALTIVEC__ 3283 #define vec_cts(__a, __b) \ 3284 _Generic((__a), vector float \ 3285 : (vector signed int)__builtin_altivec_vctsxs((vector float)(__a), \ 3286 (__b)), \ 3287 vector double \ 3288 : __extension__({ \ 3289 vector double __ret = \ 3290 (vector double)(__a) * \ 3291 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3292 << 52); \ 3293 (vector signed long long)__builtin_vsx_xvcvdpsxws(__ret); \ 3294 })) 3295 #else // __XL_COMPAT_ALTIVEC__ 3296 #define vec_cts(__a, __b) \ 3297 _Generic((__a), vector float \ 3298 : (vector signed int)__builtin_altivec_vctsxs((vector float)(__a), \ 3299 (__b)), \ 3300 vector double \ 3301 : __extension__({ \ 3302 vector double __ret = \ 3303 (vector double)(__a) * \ 3304 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3305 << 52); \ 3306 (vector signed long long)__builtin_convertvector( \ 3307 __ret, vector signed long long); \ 3308 })) 3309 #endif // __XL_COMPAT_ALTIVEC__ 3310 #else 3311 #define vec_cts __builtin_altivec_vctsxs 3312 #endif 3313 3314 /* vec_vctsxs */ 3315 3316 #define vec_vctsxs __builtin_altivec_vctsxs 3317 3318 /* vec_ctu */ 3319 3320 #ifdef __VSX__ 3321 #ifdef __XL_COMPAT_ALTIVEC__ 3322 #define vec_ctu(__a, __b) \ 3323 _Generic((__a), vector float \ 3324 : (vector unsigned int)__builtin_altivec_vctuxs( \ 3325 (vector float)(__a), (__b)), \ 3326 vector double \ 3327 : __extension__({ \ 3328 vector double __ret = \ 3329 (vector double)(__a) * \ 3330 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3331 << 52); \ 3332 (vector unsigned long long)__builtin_vsx_xvcvdpuxws(__ret); \ 3333 })) 3334 #else // __XL_COMPAT_ALTIVEC__ 3335 #define vec_ctu(__a, __b) \ 3336 _Generic((__a), vector float \ 3337 : (vector unsigned int)__builtin_altivec_vctuxs( \ 3338 (vector float)(__a), (__b)), \ 3339 vector double \ 3340 : __extension__({ \ 3341 vector double __ret = \ 3342 (vector double)(__a) * \ 3343 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3344 << 52); \ 3345 (vector unsigned long long)__builtin_convertvector( \ 3346 __ret, vector unsigned long long); \ 3347 })) 3348 #endif // __XL_COMPAT_ALTIVEC__ 3349 #else 3350 #define vec_ctu __builtin_altivec_vctuxs 3351 #endif 3352 3353 #ifdef __LITTLE_ENDIAN__ 3354 /* vec_ctsl */ 3355 3356 #ifdef __VSX__ 3357 #define vec_ctsl(__a, __b) \ 3358 _Generic((__a), vector float \ 3359 : __extension__({ \ 3360 vector float __ret = \ 3361 (vector float)(__a) * \ 3362 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3363 __builtin_vsx_xvcvspsxds( \ 3364 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3365 }), \ 3366 vector double \ 3367 : __extension__({ \ 3368 vector double __ret = \ 3369 (vector double)(__a) * \ 3370 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3371 << 52); \ 3372 __builtin_convertvector(__ret, vector signed long long); \ 3373 })) 3374 3375 /* vec_ctul */ 3376 3377 #define vec_ctul(__a, __b) \ 3378 _Generic((__a), vector float \ 3379 : __extension__({ \ 3380 vector float __ret = \ 3381 (vector float)(__a) * \ 3382 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3383 __builtin_vsx_xvcvspuxds( \ 3384 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3385 }), \ 3386 vector double \ 3387 : __extension__({ \ 3388 vector double __ret = \ 3389 (vector double)(__a) * \ 3390 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3391 << 52); \ 3392 __builtin_convertvector(__ret, vector unsigned long long); \ 3393 })) 3394 #endif 3395 #else // __LITTLE_ENDIAN__ 3396 /* vec_ctsl */ 3397 3398 #ifdef __VSX__ 3399 #define vec_ctsl(__a, __b) \ 3400 _Generic((__a), vector float \ 3401 : __extension__({ \ 3402 vector float __ret = \ 3403 (vector float)(__a) * \ 3404 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3405 __builtin_vsx_xvcvspsxds(__ret); \ 3406 }), \ 3407 vector double \ 3408 : __extension__({ \ 3409 vector double __ret = \ 3410 (vector double)(__a) * \ 3411 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3412 << 52); \ 3413 __builtin_convertvector(__ret, vector signed long long); \ 3414 })) 3415 3416 /* vec_ctul */ 3417 3418 #define vec_ctul(__a, __b) \ 3419 _Generic((__a), vector float \ 3420 : __extension__({ \ 3421 vector float __ret = \ 3422 (vector float)(__a) * \ 3423 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3424 __builtin_vsx_xvcvspuxds(__ret); \ 3425 }), \ 3426 vector double \ 3427 : __extension__({ \ 3428 vector double __ret = \ 3429 (vector double)(__a) * \ 3430 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3431 << 52); \ 3432 __builtin_convertvector(__ret, vector unsigned long long); \ 3433 })) 3434 #endif 3435 #endif // __LITTLE_ENDIAN__ 3436 3437 /* vec_vctuxs */ 3438 3439 #define vec_vctuxs __builtin_altivec_vctuxs 3440 3441 /* vec_signext */ 3442 3443 #ifdef __POWER9_VECTOR__ 3444 static __inline__ vector signed int __ATTRS_o_ai 3445 vec_signexti(vector signed char __a) { 3446 return __builtin_altivec_vextsb2w(__a); 3447 } 3448 3449 static __inline__ vector signed int __ATTRS_o_ai 3450 vec_signexti(vector signed short __a) { 3451 return __builtin_altivec_vextsh2w(__a); 3452 } 3453 3454 static __inline__ vector signed long long __ATTRS_o_ai 3455 vec_signextll(vector signed char __a) { 3456 return __builtin_altivec_vextsb2d(__a); 3457 } 3458 3459 static __inline__ vector signed long long __ATTRS_o_ai 3460 vec_signextll(vector signed short __a) { 3461 return __builtin_altivec_vextsh2d(__a); 3462 } 3463 3464 static __inline__ vector signed long long __ATTRS_o_ai 3465 vec_signextll(vector signed int __a) { 3466 return __builtin_altivec_vextsw2d(__a); 3467 } 3468 #endif 3469 3470 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3471 static __inline__ vector signed __int128 __ATTRS_o_ai 3472 vec_signextq(vector signed long long __a) { 3473 return __builtin_altivec_vextsd2q(__a); 3474 } 3475 #endif 3476 3477 /* vec_signed */ 3478 3479 static __inline__ vector signed int __ATTRS_o_ai 3480 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3481 3482 static __inline__ vector signed int __ATTRS_o_ai 3483 vec_signed(vector float __a) { 3484 return __builtin_convertvector(__a, vector signed int); 3485 } 3486 3487 #ifdef __VSX__ 3488 static __inline__ vector signed long long __ATTRS_o_ai 3489 vec_signed(vector double __a) { 3490 return __builtin_convertvector(__a, vector signed long long); 3491 } 3492 3493 static __inline__ vector signed int __attribute__((__always_inline__)) 3494 vec_signed2(vector double __a, vector double __b) { 3495 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3496 } 3497 3498 static __inline__ vector signed int __ATTRS_o_ai 3499 vec_signede(vector double __a) { 3500 #ifdef __LITTLE_ENDIAN__ 3501 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3502 return vec_sld(__ret, __ret, 12); 3503 #else 3504 return __builtin_vsx_xvcvdpsxws(__a); 3505 #endif 3506 } 3507 3508 static __inline__ vector signed int __ATTRS_o_ai 3509 vec_signedo(vector double __a) { 3510 #ifdef __LITTLE_ENDIAN__ 3511 return __builtin_vsx_xvcvdpsxws(__a); 3512 #else 3513 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3514 return vec_sld(__ret, __ret, 12); 3515 #endif 3516 } 3517 #endif 3518 3519 /* vec_unsigned */ 3520 3521 static __inline__ vector unsigned int __ATTRS_o_ai 3522 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3523 3524 static __inline__ vector unsigned int __ATTRS_o_ai 3525 vec_unsigned(vector float __a) { 3526 return __builtin_convertvector(__a, vector unsigned int); 3527 } 3528 3529 #ifdef __VSX__ 3530 static __inline__ vector unsigned long long __ATTRS_o_ai 3531 vec_unsigned(vector double __a) { 3532 return __builtin_convertvector(__a, vector unsigned long long); 3533 } 3534 3535 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3536 vec_unsigned2(vector double __a, vector double __b) { 3537 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3538 } 3539 3540 static __inline__ vector unsigned int __ATTRS_o_ai 3541 vec_unsignede(vector double __a) { 3542 #ifdef __LITTLE_ENDIAN__ 3543 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3544 return vec_sld(__ret, __ret, 12); 3545 #else 3546 return __builtin_vsx_xvcvdpuxws(__a); 3547 #endif 3548 } 3549 3550 static __inline__ vector unsigned int __ATTRS_o_ai 3551 vec_unsignedo(vector double __a) { 3552 #ifdef __LITTLE_ENDIAN__ 3553 return __builtin_vsx_xvcvdpuxws(__a); 3554 #else 3555 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3556 return vec_sld(__ret, __ret, 12); 3557 #endif 3558 } 3559 #endif 3560 3561 /* vec_float */ 3562 3563 static __inline__ vector float __ATTRS_o_ai 3564 vec_sld(vector float, vector float, unsigned const int __c); 3565 3566 static __inline__ vector float __ATTRS_o_ai 3567 vec_float(vector signed int __a) { 3568 return __builtin_convertvector(__a, vector float); 3569 } 3570 3571 static __inline__ vector float __ATTRS_o_ai 3572 vec_float(vector unsigned int __a) { 3573 return __builtin_convertvector(__a, vector float); 3574 } 3575 3576 #ifdef __VSX__ 3577 static __inline__ vector float __ATTRS_o_ai 3578 vec_float2(vector signed long long __a, vector signed long long __b) { 3579 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3580 } 3581 3582 static __inline__ vector float __ATTRS_o_ai 3583 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3584 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3585 } 3586 3587 static __inline__ vector float __ATTRS_o_ai 3588 vec_float2(vector double __a, vector double __b) { 3589 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3590 } 3591 3592 static __inline__ vector float __ATTRS_o_ai 3593 vec_floate(vector signed long long __a) { 3594 #ifdef __LITTLE_ENDIAN__ 3595 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3596 return vec_sld(__ret, __ret, 12); 3597 #else 3598 return __builtin_vsx_xvcvsxdsp(__a); 3599 #endif 3600 } 3601 3602 static __inline__ vector float __ATTRS_o_ai 3603 vec_floate(vector unsigned long long __a) { 3604 #ifdef __LITTLE_ENDIAN__ 3605 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3606 return vec_sld(__ret, __ret, 12); 3607 #else 3608 return __builtin_vsx_xvcvuxdsp(__a); 3609 #endif 3610 } 3611 3612 static __inline__ vector float __ATTRS_o_ai 3613 vec_floate(vector double __a) { 3614 #ifdef __LITTLE_ENDIAN__ 3615 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3616 return vec_sld(__ret, __ret, 12); 3617 #else 3618 return __builtin_vsx_xvcvdpsp(__a); 3619 #endif 3620 } 3621 3622 static __inline__ vector float __ATTRS_o_ai 3623 vec_floato(vector signed long long __a) { 3624 #ifdef __LITTLE_ENDIAN__ 3625 return __builtin_vsx_xvcvsxdsp(__a); 3626 #else 3627 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3628 return vec_sld(__ret, __ret, 12); 3629 #endif 3630 } 3631 3632 static __inline__ vector float __ATTRS_o_ai 3633 vec_floato(vector unsigned long long __a) { 3634 #ifdef __LITTLE_ENDIAN__ 3635 return __builtin_vsx_xvcvuxdsp(__a); 3636 #else 3637 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3638 return vec_sld(__ret, __ret, 12); 3639 #endif 3640 } 3641 3642 static __inline__ vector float __ATTRS_o_ai 3643 vec_floato(vector double __a) { 3644 #ifdef __LITTLE_ENDIAN__ 3645 return __builtin_vsx_xvcvdpsp(__a); 3646 #else 3647 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3648 return vec_sld(__ret, __ret, 12); 3649 #endif 3650 } 3651 #endif 3652 3653 /* vec_double */ 3654 3655 #ifdef __VSX__ 3656 static __inline__ vector double __ATTRS_o_ai 3657 vec_double(vector signed long long __a) { 3658 return __builtin_convertvector(__a, vector double); 3659 } 3660 3661 static __inline__ vector double __ATTRS_o_ai 3662 vec_double(vector unsigned long long __a) { 3663 return __builtin_convertvector(__a, vector double); 3664 } 3665 3666 static __inline__ vector double __ATTRS_o_ai 3667 vec_doublee(vector signed int __a) { 3668 #ifdef __LITTLE_ENDIAN__ 3669 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3670 #else 3671 return __builtin_vsx_xvcvsxwdp(__a); 3672 #endif 3673 } 3674 3675 static __inline__ vector double __ATTRS_o_ai 3676 vec_doublee(vector unsigned int __a) { 3677 #ifdef __LITTLE_ENDIAN__ 3678 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3679 #else 3680 return __builtin_vsx_xvcvuxwdp(__a); 3681 #endif 3682 } 3683 3684 static __inline__ vector double __ATTRS_o_ai 3685 vec_doublee(vector float __a) { 3686 #ifdef __LITTLE_ENDIAN__ 3687 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3688 #else 3689 return __builtin_vsx_xvcvspdp(__a); 3690 #endif 3691 } 3692 3693 static __inline__ vector double __ATTRS_o_ai 3694 vec_doubleh(vector signed int __a) { 3695 vector double __ret = {__a[0], __a[1]}; 3696 return __ret; 3697 } 3698 3699 static __inline__ vector double __ATTRS_o_ai 3700 vec_doubleh(vector unsigned int __a) { 3701 vector double __ret = {__a[0], __a[1]}; 3702 return __ret; 3703 } 3704 3705 static __inline__ vector double __ATTRS_o_ai 3706 vec_doubleh(vector float __a) { 3707 vector double __ret = {__a[0], __a[1]}; 3708 return __ret; 3709 } 3710 3711 static __inline__ vector double __ATTRS_o_ai 3712 vec_doublel(vector signed int __a) { 3713 vector double __ret = {__a[2], __a[3]}; 3714 return __ret; 3715 } 3716 3717 static __inline__ vector double __ATTRS_o_ai 3718 vec_doublel(vector unsigned int __a) { 3719 vector double __ret = {__a[2], __a[3]}; 3720 return __ret; 3721 } 3722 3723 static __inline__ vector double __ATTRS_o_ai 3724 vec_doublel(vector float __a) { 3725 vector double __ret = {__a[2], __a[3]}; 3726 return __ret; 3727 } 3728 3729 static __inline__ vector double __ATTRS_o_ai 3730 vec_doubleo(vector signed int __a) { 3731 #ifdef __LITTLE_ENDIAN__ 3732 return __builtin_vsx_xvcvsxwdp(__a); 3733 #else 3734 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3735 #endif 3736 } 3737 3738 static __inline__ vector double __ATTRS_o_ai 3739 vec_doubleo(vector unsigned int __a) { 3740 #ifdef __LITTLE_ENDIAN__ 3741 return __builtin_vsx_xvcvuxwdp(__a); 3742 #else 3743 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3744 #endif 3745 } 3746 3747 static __inline__ vector double __ATTRS_o_ai 3748 vec_doubleo(vector float __a) { 3749 #ifdef __LITTLE_ENDIAN__ 3750 return __builtin_vsx_xvcvspdp(__a); 3751 #else 3752 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3753 #endif 3754 } 3755 3756 /* vec_cvf */ 3757 static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) { 3758 return vec_doublee(__a); 3759 } 3760 3761 static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) { 3762 return vec_floate(__a); 3763 } 3764 #endif 3765 3766 /* vec_div */ 3767 3768 /* Integer vector divides (vectors are scalarized, elements divided 3769 and the vectors reassembled). 3770 */ 3771 static __inline__ vector signed char __ATTRS_o_ai 3772 vec_div(vector signed char __a, vector signed char __b) { 3773 return __a / __b; 3774 } 3775 3776 static __inline__ vector unsigned char __ATTRS_o_ai 3777 vec_div(vector unsigned char __a, vector unsigned char __b) { 3778 return __a / __b; 3779 } 3780 3781 static __inline__ vector signed short __ATTRS_o_ai 3782 vec_div(vector signed short __a, vector signed short __b) { 3783 return __a / __b; 3784 } 3785 3786 static __inline__ vector unsigned short __ATTRS_o_ai 3787 vec_div(vector unsigned short __a, vector unsigned short __b) { 3788 return __a / __b; 3789 } 3790 3791 static __inline__ vector signed int __ATTRS_o_ai 3792 vec_div(vector signed int __a, vector signed int __b) { 3793 return __a / __b; 3794 } 3795 3796 static __inline__ vector unsigned int __ATTRS_o_ai 3797 vec_div(vector unsigned int __a, vector unsigned int __b) { 3798 return __a / __b; 3799 } 3800 3801 #ifdef __VSX__ 3802 static __inline__ vector signed long long __ATTRS_o_ai 3803 vec_div(vector signed long long __a, vector signed long long __b) { 3804 return __a / __b; 3805 } 3806 3807 static __inline__ vector unsigned long long __ATTRS_o_ai 3808 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3809 return __a / __b; 3810 } 3811 3812 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3813 vector float __b) { 3814 return __a / __b; 3815 } 3816 3817 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3818 vector double __b) { 3819 return __a / __b; 3820 } 3821 #endif 3822 3823 /* vec_dive */ 3824 3825 #ifdef __POWER10_VECTOR__ 3826 static __inline__ vector signed int __ATTRS_o_ai 3827 vec_dive(vector signed int __a, vector signed int __b) { 3828 return __builtin_altivec_vdivesw(__a, __b); 3829 } 3830 3831 static __inline__ vector unsigned int __ATTRS_o_ai 3832 vec_dive(vector unsigned int __a, vector unsigned int __b) { 3833 return __builtin_altivec_vdiveuw(__a, __b); 3834 } 3835 3836 static __inline__ vector signed long long __ATTRS_o_ai 3837 vec_dive(vector signed long long __a, vector signed long long __b) { 3838 return __builtin_altivec_vdivesd(__a, __b); 3839 } 3840 3841 static __inline__ vector unsigned long long __ATTRS_o_ai 3842 vec_dive(vector unsigned long long __a, vector unsigned long long __b) { 3843 return __builtin_altivec_vdiveud(__a, __b); 3844 } 3845 3846 #ifdef __SIZEOF_INT128__ 3847 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3848 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3849 return __builtin_altivec_vdiveuq(__a, __b); 3850 } 3851 3852 static __inline__ vector signed __int128 __ATTRS_o_ai 3853 vec_dive(vector signed __int128 __a, vector signed __int128 __b) { 3854 return __builtin_altivec_vdivesq(__a, __b); 3855 } 3856 #endif 3857 #endif 3858 3859 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3860 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3861 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3862 return __a / __b; 3863 } 3864 3865 static __inline__ vector signed __int128 __ATTRS_o_ai 3866 vec_div(vector signed __int128 __a, vector signed __int128 __b) { 3867 return __a / __b; 3868 } 3869 #endif /* __POWER10_VECTOR__ */ 3870 3871 /* vec_xvtdiv */ 3872 3873 #ifdef __VSX__ 3874 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, 3875 vector double __b) { 3876 return __builtin_vsx_xvtdivdp(__a, __b); 3877 } 3878 3879 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, 3880 vector float __b) { 3881 return __builtin_vsx_xvtdivsp(__a, __b); 3882 } 3883 #endif 3884 3885 /* vec_dss */ 3886 3887 #define vec_dss __builtin_altivec_dss 3888 3889 /* vec_dssall */ 3890 3891 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3892 __builtin_altivec_dssall(); 3893 } 3894 3895 /* vec_dst */ 3896 #define vec_dst(__PTR, __CW, __STR) \ 3897 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) 3898 3899 /* vec_dstst */ 3900 #define vec_dstst(__PTR, __CW, __STR) \ 3901 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) 3902 3903 /* vec_dststt */ 3904 #define vec_dststt(__PTR, __CW, __STR) \ 3905 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) 3906 3907 /* vec_dstt */ 3908 #define vec_dstt(__PTR, __CW, __STR) \ 3909 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) 3910 3911 /* vec_eqv */ 3912 3913 #ifdef __POWER8_VECTOR__ 3914 static __inline__ vector signed char __ATTRS_o_ai 3915 vec_eqv(vector signed char __a, vector signed char __b) { 3916 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3917 (vector unsigned int)__b); 3918 } 3919 3920 static __inline__ vector unsigned char __ATTRS_o_ai 3921 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3922 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3923 (vector unsigned int)__b); 3924 } 3925 3926 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3927 vector bool char __b) { 3928 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3929 (vector unsigned int)__b); 3930 } 3931 3932 static __inline__ vector signed short __ATTRS_o_ai 3933 vec_eqv(vector signed short __a, vector signed short __b) { 3934 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3935 (vector unsigned int)__b); 3936 } 3937 3938 static __inline__ vector unsigned short __ATTRS_o_ai 3939 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3940 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3941 (vector unsigned int)__b); 3942 } 3943 3944 static __inline__ vector bool short __ATTRS_o_ai 3945 vec_eqv(vector bool short __a, vector bool short __b) { 3946 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3947 (vector unsigned int)__b); 3948 } 3949 3950 static __inline__ vector signed int __ATTRS_o_ai 3951 vec_eqv(vector signed int __a, vector signed int __b) { 3952 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3953 (vector unsigned int)__b); 3954 } 3955 3956 static __inline__ vector unsigned int __ATTRS_o_ai 3957 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3958 return __builtin_vsx_xxleqv(__a, __b); 3959 } 3960 3961 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3962 vector bool int __b) { 3963 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3964 (vector unsigned int)__b); 3965 } 3966 3967 static __inline__ vector signed long long __ATTRS_o_ai 3968 vec_eqv(vector signed long long __a, vector signed long long __b) { 3969 return (vector signed long long)__builtin_vsx_xxleqv( 3970 (vector unsigned int)__a, (vector unsigned int)__b); 3971 } 3972 3973 static __inline__ vector unsigned long long __ATTRS_o_ai 3974 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3975 return (vector unsigned long long)__builtin_vsx_xxleqv( 3976 (vector unsigned int)__a, (vector unsigned int)__b); 3977 } 3978 3979 static __inline__ vector bool long long __ATTRS_o_ai 3980 vec_eqv(vector bool long long __a, vector bool long long __b) { 3981 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3982 (vector unsigned int)__b); 3983 } 3984 3985 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3986 vector float __b) { 3987 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3988 (vector unsigned int)__b); 3989 } 3990 3991 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3992 vector double __b) { 3993 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3994 (vector unsigned int)__b); 3995 } 3996 #endif 3997 3998 /* vec_expte */ 3999 4000 static __inline__ vector float __attribute__((__always_inline__)) 4001 vec_expte(vector float __a) { 4002 return __builtin_altivec_vexptefp(__a); 4003 } 4004 4005 /* vec_vexptefp */ 4006 4007 static __inline__ vector float __attribute__((__always_inline__)) 4008 vec_vexptefp(vector float __a) { 4009 return __builtin_altivec_vexptefp(__a); 4010 } 4011 4012 /* vec_floor */ 4013 4014 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 4015 #ifdef __VSX__ 4016 return __builtin_vsx_xvrspim(__a); 4017 #else 4018 return __builtin_altivec_vrfim(__a); 4019 #endif 4020 } 4021 4022 #ifdef __VSX__ 4023 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 4024 return __builtin_vsx_xvrdpim(__a); 4025 } 4026 #endif 4027 4028 /* vec_roundm */ 4029 static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { 4030 return vec_floor(__a); 4031 } 4032 4033 #ifdef __VSX__ 4034 static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { 4035 return vec_floor(__a); 4036 } 4037 #endif 4038 4039 /* vec_vrfim */ 4040 4041 static __inline__ vector float __attribute__((__always_inline__)) 4042 vec_vrfim(vector float __a) { 4043 return __builtin_altivec_vrfim(__a); 4044 } 4045 4046 /* vec_ld */ 4047 4048 static __inline__ vector signed char __ATTRS_o_ai 4049 vec_ld(long __a, const vector signed char *__b) { 4050 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4051 } 4052 4053 static __inline__ vector signed char __ATTRS_o_ai 4054 vec_ld(long __a, const signed char *__b) { 4055 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4056 } 4057 4058 static __inline__ vector unsigned char __ATTRS_o_ai 4059 vec_ld(long __a, const vector unsigned char *__b) { 4060 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4061 } 4062 4063 static __inline__ vector unsigned char __ATTRS_o_ai 4064 vec_ld(long __a, const unsigned char *__b) { 4065 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4066 } 4067 4068 static __inline__ vector bool char __ATTRS_o_ai 4069 vec_ld(long __a, const vector bool char *__b) { 4070 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4071 } 4072 4073 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, 4074 const vector short *__b) { 4075 return (vector short)__builtin_altivec_lvx(__a, __b); 4076 } 4077 4078 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) { 4079 return (vector short)__builtin_altivec_lvx(__a, __b); 4080 } 4081 4082 static __inline__ vector unsigned short __ATTRS_o_ai 4083 vec_ld(long __a, const vector unsigned short *__b) { 4084 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4085 } 4086 4087 static __inline__ vector unsigned short __ATTRS_o_ai 4088 vec_ld(long __a, const unsigned short *__b) { 4089 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4090 } 4091 4092 static __inline__ vector bool short __ATTRS_o_ai 4093 vec_ld(long __a, const vector bool short *__b) { 4094 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4095 } 4096 4097 static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a, 4098 const vector pixel *__b) { 4099 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4100 } 4101 4102 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, 4103 const vector int *__b) { 4104 return (vector int)__builtin_altivec_lvx(__a, __b); 4105 } 4106 4107 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) { 4108 return (vector int)__builtin_altivec_lvx(__a, __b); 4109 } 4110 4111 static __inline__ vector unsigned int __ATTRS_o_ai 4112 vec_ld(long __a, const vector unsigned int *__b) { 4113 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4114 } 4115 4116 static __inline__ vector unsigned int __ATTRS_o_ai 4117 vec_ld(long __a, const unsigned int *__b) { 4118 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4119 } 4120 4121 static __inline__ vector bool int __ATTRS_o_ai 4122 vec_ld(long __a, const vector bool int *__b) { 4123 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4124 } 4125 4126 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, 4127 const vector float *__b) { 4128 return (vector float)__builtin_altivec_lvx(__a, __b); 4129 } 4130 4131 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) { 4132 return (vector float)__builtin_altivec_lvx(__a, __b); 4133 } 4134 4135 /* vec_lvx */ 4136 4137 static __inline__ vector signed char __ATTRS_o_ai 4138 vec_lvx(long __a, const vector signed char *__b) { 4139 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4140 } 4141 4142 static __inline__ vector signed char __ATTRS_o_ai 4143 vec_lvx(long __a, const signed char *__b) { 4144 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4145 } 4146 4147 static __inline__ vector unsigned char __ATTRS_o_ai 4148 vec_lvx(long __a, const vector unsigned char *__b) { 4149 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4150 } 4151 4152 static __inline__ vector unsigned char __ATTRS_o_ai 4153 vec_lvx(long __a, const unsigned char *__b) { 4154 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4155 } 4156 4157 static __inline__ vector bool char __ATTRS_o_ai 4158 vec_lvx(long __a, const vector bool char *__b) { 4159 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4160 } 4161 4162 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, 4163 const vector short *__b) { 4164 return (vector short)__builtin_altivec_lvx(__a, __b); 4165 } 4166 4167 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) { 4168 return (vector short)__builtin_altivec_lvx(__a, __b); 4169 } 4170 4171 static __inline__ vector unsigned short __ATTRS_o_ai 4172 vec_lvx(long __a, const vector unsigned short *__b) { 4173 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4174 } 4175 4176 static __inline__ vector unsigned short __ATTRS_o_ai 4177 vec_lvx(long __a, const unsigned short *__b) { 4178 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4179 } 4180 4181 static __inline__ vector bool short __ATTRS_o_ai 4182 vec_lvx(long __a, const vector bool short *__b) { 4183 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4184 } 4185 4186 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a, 4187 const vector pixel *__b) { 4188 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4189 } 4190 4191 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, 4192 const vector int *__b) { 4193 return (vector int)__builtin_altivec_lvx(__a, __b); 4194 } 4195 4196 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) { 4197 return (vector int)__builtin_altivec_lvx(__a, __b); 4198 } 4199 4200 static __inline__ vector unsigned int __ATTRS_o_ai 4201 vec_lvx(long __a, const vector unsigned int *__b) { 4202 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4203 } 4204 4205 static __inline__ vector unsigned int __ATTRS_o_ai 4206 vec_lvx(long __a, const unsigned int *__b) { 4207 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4208 } 4209 4210 static __inline__ vector bool int __ATTRS_o_ai 4211 vec_lvx(long __a, const vector bool int *__b) { 4212 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4213 } 4214 4215 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, 4216 const vector float *__b) { 4217 return (vector float)__builtin_altivec_lvx(__a, __b); 4218 } 4219 4220 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) { 4221 return (vector float)__builtin_altivec_lvx(__a, __b); 4222 } 4223 4224 /* vec_lde */ 4225 4226 static __inline__ vector signed char __ATTRS_o_ai 4227 vec_lde(long __a, const signed char *__b) { 4228 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4229 } 4230 4231 static __inline__ vector unsigned char __ATTRS_o_ai 4232 vec_lde(long __a, const unsigned char *__b) { 4233 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4234 } 4235 4236 static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, 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_lde(long __a, const unsigned short *__b) { 4242 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4243 } 4244 4245 static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) { 4246 return (vector int)__builtin_altivec_lvewx(__a, __b); 4247 } 4248 4249 static __inline__ vector unsigned int __ATTRS_o_ai 4250 vec_lde(long __a, const unsigned int *__b) { 4251 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4252 } 4253 4254 static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) { 4255 return (vector float)__builtin_altivec_lvewx(__a, __b); 4256 } 4257 4258 /* vec_lvebx */ 4259 4260 static __inline__ vector signed char __ATTRS_o_ai 4261 vec_lvebx(long __a, const signed char *__b) { 4262 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4263 } 4264 4265 static __inline__ vector unsigned char __ATTRS_o_ai 4266 vec_lvebx(long __a, const unsigned char *__b) { 4267 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4268 } 4269 4270 /* vec_lvehx */ 4271 4272 static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, 4273 const short *__b) { 4274 return (vector short)__builtin_altivec_lvehx(__a, __b); 4275 } 4276 4277 static __inline__ vector unsigned short __ATTRS_o_ai 4278 vec_lvehx(long __a, const unsigned short *__b) { 4279 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4280 } 4281 4282 /* vec_lvewx */ 4283 4284 static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) { 4285 return (vector int)__builtin_altivec_lvewx(__a, __b); 4286 } 4287 4288 static __inline__ vector unsigned int __ATTRS_o_ai 4289 vec_lvewx(long __a, const unsigned int *__b) { 4290 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4291 } 4292 4293 static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a, 4294 const float *__b) { 4295 return (vector float)__builtin_altivec_lvewx(__a, __b); 4296 } 4297 4298 /* vec_ldl */ 4299 4300 static __inline__ vector signed char __ATTRS_o_ai 4301 vec_ldl(long __a, const vector signed char *__b) { 4302 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4303 } 4304 4305 static __inline__ vector signed char __ATTRS_o_ai 4306 vec_ldl(long __a, const signed char *__b) { 4307 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4308 } 4309 4310 static __inline__ vector unsigned char __ATTRS_o_ai 4311 vec_ldl(long __a, const vector unsigned char *__b) { 4312 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4313 } 4314 4315 static __inline__ vector unsigned char __ATTRS_o_ai 4316 vec_ldl(long __a, const unsigned char *__b) { 4317 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4318 } 4319 4320 static __inline__ vector bool char __ATTRS_o_ai 4321 vec_ldl(long __a, const vector bool char *__b) { 4322 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4323 } 4324 4325 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, 4326 const vector short *__b) { 4327 return (vector short)__builtin_altivec_lvxl(__a, __b); 4328 } 4329 4330 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) { 4331 return (vector short)__builtin_altivec_lvxl(__a, __b); 4332 } 4333 4334 static __inline__ vector unsigned short __ATTRS_o_ai 4335 vec_ldl(long __a, const vector unsigned short *__b) { 4336 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4337 } 4338 4339 static __inline__ vector unsigned short __ATTRS_o_ai 4340 vec_ldl(long __a, const unsigned short *__b) { 4341 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4342 } 4343 4344 static __inline__ vector bool short __ATTRS_o_ai 4345 vec_ldl(long __a, const vector bool short *__b) { 4346 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4347 } 4348 4349 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a, 4350 const vector pixel *__b) { 4351 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 4352 } 4353 4354 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, 4355 const vector int *__b) { 4356 return (vector int)__builtin_altivec_lvxl(__a, __b); 4357 } 4358 4359 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) { 4360 return (vector int)__builtin_altivec_lvxl(__a, __b); 4361 } 4362 4363 static __inline__ vector unsigned int __ATTRS_o_ai 4364 vec_ldl(long __a, const vector unsigned int *__b) { 4365 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4366 } 4367 4368 static __inline__ vector unsigned int __ATTRS_o_ai 4369 vec_ldl(long __a, const unsigned int *__b) { 4370 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4371 } 4372 4373 static __inline__ vector bool int __ATTRS_o_ai 4374 vec_ldl(long __a, const vector bool int *__b) { 4375 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4376 } 4377 4378 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, 4379 const vector float *__b) { 4380 return (vector float)__builtin_altivec_lvxl(__a, __b); 4381 } 4382 4383 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) { 4384 return (vector float)__builtin_altivec_lvxl(__a, __b); 4385 } 4386 4387 /* vec_lvxl */ 4388 4389 static __inline__ vector signed char __ATTRS_o_ai 4390 vec_lvxl(long __a, const vector signed char *__b) { 4391 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4392 } 4393 4394 static __inline__ vector signed char __ATTRS_o_ai 4395 vec_lvxl(long __a, const signed char *__b) { 4396 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4397 } 4398 4399 static __inline__ vector unsigned char __ATTRS_o_ai 4400 vec_lvxl(long __a, const vector unsigned char *__b) { 4401 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4402 } 4403 4404 static __inline__ vector unsigned char __ATTRS_o_ai 4405 vec_lvxl(long __a, const unsigned char *__b) { 4406 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4407 } 4408 4409 static __inline__ vector bool char __ATTRS_o_ai 4410 vec_lvxl(long __a, const vector bool char *__b) { 4411 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4412 } 4413 4414 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4415 const vector short *__b) { 4416 return (vector short)__builtin_altivec_lvxl(__a, __b); 4417 } 4418 4419 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4420 const short *__b) { 4421 return (vector short)__builtin_altivec_lvxl(__a, __b); 4422 } 4423 4424 static __inline__ vector unsigned short __ATTRS_o_ai 4425 vec_lvxl(long __a, const vector unsigned short *__b) { 4426 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4427 } 4428 4429 static __inline__ vector unsigned short __ATTRS_o_ai 4430 vec_lvxl(long __a, const unsigned short *__b) { 4431 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4432 } 4433 4434 static __inline__ vector bool short __ATTRS_o_ai 4435 vec_lvxl(long __a, const vector bool short *__b) { 4436 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4437 } 4438 4439 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a, 4440 const vector pixel *__b) { 4441 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 4442 } 4443 4444 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, 4445 const vector int *__b) { 4446 return (vector int)__builtin_altivec_lvxl(__a, __b); 4447 } 4448 4449 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) { 4450 return (vector int)__builtin_altivec_lvxl(__a, __b); 4451 } 4452 4453 static __inline__ vector unsigned int __ATTRS_o_ai 4454 vec_lvxl(long __a, const vector unsigned int *__b) { 4455 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4456 } 4457 4458 static __inline__ vector unsigned int __ATTRS_o_ai 4459 vec_lvxl(long __a, const unsigned int *__b) { 4460 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4461 } 4462 4463 static __inline__ vector bool int __ATTRS_o_ai 4464 vec_lvxl(long __a, const vector bool int *__b) { 4465 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4466 } 4467 4468 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4469 const vector float *__b) { 4470 return (vector float)__builtin_altivec_lvxl(__a, __b); 4471 } 4472 4473 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4474 const float *__b) { 4475 return (vector float)__builtin_altivec_lvxl(__a, __b); 4476 } 4477 4478 /* vec_loge */ 4479 4480 static __inline__ vector float __attribute__((__always_inline__)) 4481 vec_loge(vector float __a) { 4482 return __builtin_altivec_vlogefp(__a); 4483 } 4484 4485 /* vec_vlogefp */ 4486 4487 static __inline__ vector float __attribute__((__always_inline__)) 4488 vec_vlogefp(vector float __a) { 4489 return __builtin_altivec_vlogefp(__a); 4490 } 4491 4492 /* vec_lvsl */ 4493 4494 #ifdef __LITTLE_ENDIAN__ 4495 static __inline__ vector unsigned char __ATTRS_o_ai 4496 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4497 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 4498 vector unsigned char mask = 4499 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4500 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4501 7, 6, 5, 4, 3, 2, 1, 0}; 4502 return vec_perm(mask, mask, reverse); 4503 } 4504 #else 4505 static __inline__ vector unsigned char __ATTRS_o_ai 4506 vec_lvsl(int __a, const signed char *__b) { 4507 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4508 } 4509 #endif 4510 4511 #ifdef __LITTLE_ENDIAN__ 4512 static __inline__ vector unsigned char __ATTRS_o_ai 4513 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4514 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 4515 vector unsigned char mask = 4516 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4517 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4518 7, 6, 5, 4, 3, 2, 1, 0}; 4519 return vec_perm(mask, mask, reverse); 4520 } 4521 #else 4522 static __inline__ vector unsigned char __ATTRS_o_ai 4523 vec_lvsl(int __a, const unsigned char *__b) { 4524 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4525 } 4526 #endif 4527 4528 #ifdef __LITTLE_ENDIAN__ 4529 static __inline__ vector unsigned char __ATTRS_o_ai 4530 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4531 loads/stores"))) vec_lvsl(int __a, const short *__b) { 4532 vector unsigned char mask = 4533 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4534 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4535 7, 6, 5, 4, 3, 2, 1, 0}; 4536 return vec_perm(mask, mask, reverse); 4537 } 4538 #else 4539 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4540 const short *__b) { 4541 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4542 } 4543 #endif 4544 4545 #ifdef __LITTLE_ENDIAN__ 4546 static __inline__ vector unsigned char __ATTRS_o_ai 4547 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4548 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4549 vector unsigned char mask = 4550 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4551 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4552 7, 6, 5, 4, 3, 2, 1, 0}; 4553 return vec_perm(mask, mask, reverse); 4554 } 4555 #else 4556 static __inline__ vector unsigned char __ATTRS_o_ai 4557 vec_lvsl(int __a, const unsigned short *__b) { 4558 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4559 } 4560 #endif 4561 4562 #ifdef __LITTLE_ENDIAN__ 4563 static __inline__ vector unsigned char __ATTRS_o_ai 4564 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4565 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4566 vector unsigned char mask = 4567 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4568 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4569 7, 6, 5, 4, 3, 2, 1, 0}; 4570 return vec_perm(mask, mask, reverse); 4571 } 4572 #else 4573 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4574 const int *__b) { 4575 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4576 } 4577 #endif 4578 4579 #ifdef __LITTLE_ENDIAN__ 4580 static __inline__ vector unsigned char __ATTRS_o_ai 4581 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4582 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4583 vector unsigned char mask = 4584 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4585 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4586 7, 6, 5, 4, 3, 2, 1, 0}; 4587 return vec_perm(mask, mask, reverse); 4588 } 4589 #else 4590 static __inline__ vector unsigned char __ATTRS_o_ai 4591 vec_lvsl(int __a, const unsigned int *__b) { 4592 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4593 } 4594 #endif 4595 4596 #ifdef __LITTLE_ENDIAN__ 4597 static __inline__ vector unsigned char __ATTRS_o_ai 4598 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4599 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4600 vector unsigned char mask = 4601 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4602 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4603 7, 6, 5, 4, 3, 2, 1, 0}; 4604 return vec_perm(mask, mask, reverse); 4605 } 4606 #else 4607 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4608 const float *__b) { 4609 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4610 } 4611 #endif 4612 4613 /* vec_lvsr */ 4614 4615 #ifdef __LITTLE_ENDIAN__ 4616 static __inline__ vector unsigned char __ATTRS_o_ai 4617 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4618 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4619 vector unsigned char mask = 4620 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4621 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4622 7, 6, 5, 4, 3, 2, 1, 0}; 4623 return vec_perm(mask, mask, reverse); 4624 } 4625 #else 4626 static __inline__ vector unsigned char __ATTRS_o_ai 4627 vec_lvsr(int __a, const signed char *__b) { 4628 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4629 } 4630 #endif 4631 4632 #ifdef __LITTLE_ENDIAN__ 4633 static __inline__ vector unsigned char __ATTRS_o_ai 4634 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4635 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4636 vector unsigned char mask = 4637 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4638 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4639 7, 6, 5, 4, 3, 2, 1, 0}; 4640 return vec_perm(mask, mask, reverse); 4641 } 4642 #else 4643 static __inline__ vector unsigned char __ATTRS_o_ai 4644 vec_lvsr(int __a, const unsigned char *__b) { 4645 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4646 } 4647 #endif 4648 4649 #ifdef __LITTLE_ENDIAN__ 4650 static __inline__ vector unsigned char __ATTRS_o_ai 4651 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4652 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4653 vector unsigned char mask = 4654 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4655 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4656 7, 6, 5, 4, 3, 2, 1, 0}; 4657 return vec_perm(mask, mask, reverse); 4658 } 4659 #else 4660 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4661 const short *__b) { 4662 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4663 } 4664 #endif 4665 4666 #ifdef __LITTLE_ENDIAN__ 4667 static __inline__ vector unsigned char __ATTRS_o_ai 4668 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4669 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4670 vector unsigned char mask = 4671 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4672 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4673 7, 6, 5, 4, 3, 2, 1, 0}; 4674 return vec_perm(mask, mask, reverse); 4675 } 4676 #else 4677 static __inline__ vector unsigned char __ATTRS_o_ai 4678 vec_lvsr(int __a, const unsigned short *__b) { 4679 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4680 } 4681 #endif 4682 4683 #ifdef __LITTLE_ENDIAN__ 4684 static __inline__ vector unsigned char __ATTRS_o_ai 4685 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4686 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4687 vector unsigned char mask = 4688 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4689 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4690 7, 6, 5, 4, 3, 2, 1, 0}; 4691 return vec_perm(mask, mask, reverse); 4692 } 4693 #else 4694 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4695 const int *__b) { 4696 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4697 } 4698 #endif 4699 4700 #ifdef __LITTLE_ENDIAN__ 4701 static __inline__ vector unsigned char __ATTRS_o_ai 4702 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4703 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4704 vector unsigned char mask = 4705 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4706 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4707 7, 6, 5, 4, 3, 2, 1, 0}; 4708 return vec_perm(mask, mask, reverse); 4709 } 4710 #else 4711 static __inline__ vector unsigned char __ATTRS_o_ai 4712 vec_lvsr(int __a, const unsigned int *__b) { 4713 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4714 } 4715 #endif 4716 4717 #ifdef __LITTLE_ENDIAN__ 4718 static __inline__ vector unsigned char __ATTRS_o_ai 4719 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4720 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4721 vector unsigned char mask = 4722 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4723 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4724 7, 6, 5, 4, 3, 2, 1, 0}; 4725 return vec_perm(mask, mask, reverse); 4726 } 4727 #else 4728 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4729 const float *__b) { 4730 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4731 } 4732 #endif 4733 4734 /* vec_madd */ 4735 static __inline__ vector signed short __ATTRS_o_ai 4736 vec_mladd(vector signed short, vector signed short, vector signed short); 4737 static __inline__ vector signed short __ATTRS_o_ai 4738 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4739 static __inline__ vector signed short __ATTRS_o_ai 4740 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4741 static __inline__ vector unsigned short __ATTRS_o_ai 4742 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4743 4744 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4745 vector signed short __a, vector signed short __b, vector signed short __c) { 4746 return vec_mladd(__a, __b, __c); 4747 } 4748 4749 static __inline__ vector signed short __ATTRS_o_ai 4750 vec_madd(vector signed short __a, vector unsigned short __b, 4751 vector unsigned short __c) { 4752 return vec_mladd(__a, __b, __c); 4753 } 4754 4755 static __inline__ vector signed short __ATTRS_o_ai 4756 vec_madd(vector unsigned short __a, vector signed short __b, 4757 vector signed short __c) { 4758 return vec_mladd(__a, __b, __c); 4759 } 4760 4761 static __inline__ vector unsigned short __ATTRS_o_ai 4762 vec_madd(vector unsigned short __a, vector unsigned short __b, 4763 vector unsigned short __c) { 4764 return vec_mladd(__a, __b, __c); 4765 } 4766 4767 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4768 vector float __b, 4769 vector float __c) { 4770 #ifdef __VSX__ 4771 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4772 #else 4773 return __builtin_altivec_vmaddfp(__a, __b, __c); 4774 #endif 4775 } 4776 4777 #ifdef __VSX__ 4778 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4779 vector double __b, 4780 vector double __c) { 4781 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4782 } 4783 #endif 4784 4785 /* vec_vmaddfp */ 4786 4787 static __inline__ vector float __attribute__((__always_inline__)) 4788 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4789 return __builtin_altivec_vmaddfp(__a, __b, __c); 4790 } 4791 4792 /* vec_madds */ 4793 4794 static __inline__ vector signed short __attribute__((__always_inline__)) 4795 vec_madds(vector signed short __a, vector signed short __b, 4796 vector signed short __c) { 4797 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4798 } 4799 4800 /* vec_vmhaddshs */ 4801 static __inline__ vector signed short __attribute__((__always_inline__)) 4802 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4803 vector signed short __c) { 4804 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4805 } 4806 4807 /* vec_msub */ 4808 4809 #ifdef __VSX__ 4810 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4811 vector float __b, 4812 vector float __c) { 4813 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4814 } 4815 4816 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4817 vector double __b, 4818 vector double __c) { 4819 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4820 } 4821 #endif 4822 4823 /* vec_max */ 4824 4825 static __inline__ vector signed char __ATTRS_o_ai 4826 vec_max(vector signed char __a, vector signed char __b) { 4827 return __builtin_altivec_vmaxsb(__a, __b); 4828 } 4829 4830 static __inline__ vector signed char __ATTRS_o_ai 4831 vec_max(vector bool char __a, vector signed char __b) { 4832 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4833 } 4834 4835 static __inline__ vector signed char __ATTRS_o_ai 4836 vec_max(vector signed char __a, vector bool char __b) { 4837 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4838 } 4839 4840 static __inline__ vector unsigned char __ATTRS_o_ai 4841 vec_max(vector unsigned char __a, vector unsigned char __b) { 4842 return __builtin_altivec_vmaxub(__a, __b); 4843 } 4844 4845 static __inline__ vector unsigned char __ATTRS_o_ai 4846 vec_max(vector bool char __a, vector unsigned char __b) { 4847 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4848 } 4849 4850 static __inline__ vector unsigned char __ATTRS_o_ai 4851 vec_max(vector unsigned char __a, vector bool char __b) { 4852 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4853 } 4854 4855 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4856 vector short __b) { 4857 return __builtin_altivec_vmaxsh(__a, __b); 4858 } 4859 4860 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4861 vector short __b) { 4862 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4863 } 4864 4865 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4866 vector bool short __b) { 4867 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4868 } 4869 4870 static __inline__ vector unsigned short __ATTRS_o_ai 4871 vec_max(vector unsigned short __a, vector unsigned short __b) { 4872 return __builtin_altivec_vmaxuh(__a, __b); 4873 } 4874 4875 static __inline__ vector unsigned short __ATTRS_o_ai 4876 vec_max(vector bool short __a, vector unsigned short __b) { 4877 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4878 } 4879 4880 static __inline__ vector unsigned short __ATTRS_o_ai 4881 vec_max(vector unsigned short __a, vector bool short __b) { 4882 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4883 } 4884 4885 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4886 vector int __b) { 4887 return __builtin_altivec_vmaxsw(__a, __b); 4888 } 4889 4890 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4891 vector int __b) { 4892 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4893 } 4894 4895 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4896 vector bool int __b) { 4897 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4898 } 4899 4900 static __inline__ vector unsigned int __ATTRS_o_ai 4901 vec_max(vector unsigned int __a, vector unsigned int __b) { 4902 return __builtin_altivec_vmaxuw(__a, __b); 4903 } 4904 4905 static __inline__ vector unsigned int __ATTRS_o_ai 4906 vec_max(vector bool int __a, vector unsigned int __b) { 4907 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4908 } 4909 4910 static __inline__ vector unsigned int __ATTRS_o_ai 4911 vec_max(vector unsigned int __a, vector bool int __b) { 4912 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4913 } 4914 4915 #ifdef __POWER8_VECTOR__ 4916 static __inline__ vector signed long long __ATTRS_o_ai 4917 vec_max(vector signed long long __a, vector signed long long __b) { 4918 return __builtin_altivec_vmaxsd(__a, __b); 4919 } 4920 4921 static __inline__ vector signed long long __ATTRS_o_ai 4922 vec_max(vector bool long long __a, vector signed long long __b) { 4923 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4924 } 4925 4926 static __inline__ vector signed long long __ATTRS_o_ai 4927 vec_max(vector signed long long __a, vector bool long long __b) { 4928 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4929 } 4930 4931 static __inline__ vector unsigned long long __ATTRS_o_ai 4932 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4933 return __builtin_altivec_vmaxud(__a, __b); 4934 } 4935 4936 static __inline__ vector unsigned long long __ATTRS_o_ai 4937 vec_max(vector bool long long __a, vector unsigned long long __b) { 4938 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4939 } 4940 4941 static __inline__ vector unsigned long long __ATTRS_o_ai 4942 vec_max(vector unsigned long long __a, vector bool long long __b) { 4943 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4944 } 4945 #endif 4946 4947 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4948 vector float __b) { 4949 #ifdef __VSX__ 4950 return __builtin_vsx_xvmaxsp(__a, __b); 4951 #else 4952 return __builtin_altivec_vmaxfp(__a, __b); 4953 #endif 4954 } 4955 4956 #ifdef __VSX__ 4957 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4958 vector double __b) { 4959 return __builtin_vsx_xvmaxdp(__a, __b); 4960 } 4961 #endif 4962 4963 /* vec_vmaxsb */ 4964 4965 static __inline__ vector signed char __ATTRS_o_ai 4966 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4967 return __builtin_altivec_vmaxsb(__a, __b); 4968 } 4969 4970 static __inline__ vector signed char __ATTRS_o_ai 4971 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4972 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4973 } 4974 4975 static __inline__ vector signed char __ATTRS_o_ai 4976 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4977 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4978 } 4979 4980 /* vec_vmaxub */ 4981 4982 static __inline__ vector unsigned char __ATTRS_o_ai 4983 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4984 return __builtin_altivec_vmaxub(__a, __b); 4985 } 4986 4987 static __inline__ vector unsigned char __ATTRS_o_ai 4988 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4989 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4990 } 4991 4992 static __inline__ vector unsigned char __ATTRS_o_ai 4993 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4994 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4995 } 4996 4997 /* vec_vmaxsh */ 4998 4999 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 5000 vector short __b) { 5001 return __builtin_altivec_vmaxsh(__a, __b); 5002 } 5003 5004 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 5005 vector short __b) { 5006 return __builtin_altivec_vmaxsh((vector short)__a, __b); 5007 } 5008 5009 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 5010 vector bool short __b) { 5011 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 5012 } 5013 5014 /* vec_vmaxuh */ 5015 5016 static __inline__ vector unsigned short __ATTRS_o_ai 5017 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 5018 return __builtin_altivec_vmaxuh(__a, __b); 5019 } 5020 5021 static __inline__ vector unsigned short __ATTRS_o_ai 5022 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 5023 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 5024 } 5025 5026 static __inline__ vector unsigned short __ATTRS_o_ai 5027 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 5028 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 5029 } 5030 5031 /* vec_vmaxsw */ 5032 5033 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 5034 vector int __b) { 5035 return __builtin_altivec_vmaxsw(__a, __b); 5036 } 5037 5038 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 5039 vector int __b) { 5040 return __builtin_altivec_vmaxsw((vector int)__a, __b); 5041 } 5042 5043 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 5044 vector bool int __b) { 5045 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 5046 } 5047 5048 /* vec_vmaxuw */ 5049 5050 static __inline__ vector unsigned int __ATTRS_o_ai 5051 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 5052 return __builtin_altivec_vmaxuw(__a, __b); 5053 } 5054 5055 static __inline__ vector unsigned int __ATTRS_o_ai 5056 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 5057 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 5058 } 5059 5060 static __inline__ vector unsigned int __ATTRS_o_ai 5061 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 5062 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 5063 } 5064 5065 /* vec_vmaxfp */ 5066 5067 static __inline__ vector float __attribute__((__always_inline__)) 5068 vec_vmaxfp(vector float __a, vector float __b) { 5069 #ifdef __VSX__ 5070 return __builtin_vsx_xvmaxsp(__a, __b); 5071 #else 5072 return __builtin_altivec_vmaxfp(__a, __b); 5073 #endif 5074 } 5075 5076 /* vec_mergeh */ 5077 5078 static __inline__ vector signed char __ATTRS_o_ai 5079 vec_mergeh(vector signed char __a, vector signed char __b) { 5080 return vec_perm(__a, __b, 5081 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5082 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5083 0x06, 0x16, 0x07, 0x17)); 5084 } 5085 5086 static __inline__ vector unsigned char __ATTRS_o_ai 5087 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 5088 return vec_perm(__a, __b, 5089 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5090 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5091 0x06, 0x16, 0x07, 0x17)); 5092 } 5093 5094 static __inline__ vector bool char __ATTRS_o_ai 5095 vec_mergeh(vector bool char __a, vector bool char __b) { 5096 return vec_perm(__a, __b, 5097 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5098 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5099 0x06, 0x16, 0x07, 0x17)); 5100 } 5101 5102 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 5103 vector short __b) { 5104 return vec_perm(__a, __b, 5105 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5106 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5107 0x06, 0x07, 0x16, 0x17)); 5108 } 5109 5110 static __inline__ vector unsigned short __ATTRS_o_ai 5111 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 5112 return vec_perm(__a, __b, 5113 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5114 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5115 0x06, 0x07, 0x16, 0x17)); 5116 } 5117 5118 static __inline__ vector bool short __ATTRS_o_ai 5119 vec_mergeh(vector bool short __a, vector bool short __b) { 5120 return vec_perm(__a, __b, 5121 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5122 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5123 0x06, 0x07, 0x16, 0x17)); 5124 } 5125 5126 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 5127 vector pixel __b) { 5128 return vec_perm(__a, __b, 5129 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5130 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5131 0x06, 0x07, 0x16, 0x17)); 5132 } 5133 5134 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 5135 vector int __b) { 5136 return vec_perm(__a, __b, 5137 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5138 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5139 0x14, 0x15, 0x16, 0x17)); 5140 } 5141 5142 static __inline__ vector unsigned int __ATTRS_o_ai 5143 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 5144 return vec_perm(__a, __b, 5145 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5146 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5147 0x14, 0x15, 0x16, 0x17)); 5148 } 5149 5150 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 5151 vector bool int __b) { 5152 return vec_perm(__a, __b, 5153 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5154 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5155 0x14, 0x15, 0x16, 0x17)); 5156 } 5157 5158 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 5159 vector float __b) { 5160 return vec_perm(__a, __b, 5161 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5162 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5163 0x14, 0x15, 0x16, 0x17)); 5164 } 5165 5166 #ifdef __VSX__ 5167 static __inline__ vector signed long long __ATTRS_o_ai 5168 vec_mergeh(vector signed long long __a, vector signed long long __b) { 5169 return vec_perm(__a, __b, 5170 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5171 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5172 0x14, 0x15, 0x16, 0x17)); 5173 } 5174 5175 static __inline__ vector signed long long __ATTRS_o_ai 5176 vec_mergeh(vector signed long long __a, vector bool long long __b) { 5177 return vec_perm(__a, (vector signed long long)__b, 5178 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5179 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5180 0x14, 0x15, 0x16, 0x17)); 5181 } 5182 5183 static __inline__ vector signed long long __ATTRS_o_ai 5184 vec_mergeh(vector bool long long __a, vector signed long long __b) { 5185 return vec_perm((vector signed long long)__a, __b, 5186 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5187 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5188 0x14, 0x15, 0x16, 0x17)); 5189 } 5190 5191 static __inline__ vector unsigned long long __ATTRS_o_ai 5192 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 5193 return vec_perm(__a, __b, 5194 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5195 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5196 0x14, 0x15, 0x16, 0x17)); 5197 } 5198 5199 static __inline__ vector unsigned long long __ATTRS_o_ai 5200 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 5201 return vec_perm(__a, (vector unsigned long long)__b, 5202 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5203 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5204 0x14, 0x15, 0x16, 0x17)); 5205 } 5206 5207 static __inline__ vector unsigned long long __ATTRS_o_ai 5208 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 5209 return vec_perm((vector unsigned long long)__a, __b, 5210 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5211 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5212 0x14, 0x15, 0x16, 0x17)); 5213 } 5214 5215 static __inline__ vector bool long long __ATTRS_o_ai 5216 vec_mergeh(vector bool long long __a, vector bool long long __b) { 5217 return vec_perm(__a, __b, 5218 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5219 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5220 0x14, 0x15, 0x16, 0x17)); 5221 } 5222 5223 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 5224 vector double __b) { 5225 return vec_perm(__a, __b, 5226 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5227 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5228 0x14, 0x15, 0x16, 0x17)); 5229 } 5230 static __inline__ vector double __ATTRS_o_ai 5231 vec_mergeh(vector double __a, vector bool long long __b) { 5232 return vec_perm(__a, (vector double)__b, 5233 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5234 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5235 0x14, 0x15, 0x16, 0x17)); 5236 } 5237 static __inline__ vector double __ATTRS_o_ai 5238 vec_mergeh(vector bool long long __a, vector double __b) { 5239 return vec_perm((vector double)__a, __b, 5240 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5241 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5242 0x14, 0x15, 0x16, 0x17)); 5243 } 5244 #endif 5245 5246 /* vec_vmrghb */ 5247 5248 #define __builtin_altivec_vmrghb vec_vmrghb 5249 5250 static __inline__ vector signed char __ATTRS_o_ai 5251 vec_vmrghb(vector signed char __a, vector signed char __b) { 5252 return vec_perm(__a, __b, 5253 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5254 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5255 0x06, 0x16, 0x07, 0x17)); 5256 } 5257 5258 static __inline__ vector unsigned char __ATTRS_o_ai 5259 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 5260 return vec_perm(__a, __b, 5261 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5262 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5263 0x06, 0x16, 0x07, 0x17)); 5264 } 5265 5266 static __inline__ vector bool char __ATTRS_o_ai 5267 vec_vmrghb(vector bool char __a, vector bool char __b) { 5268 return vec_perm(__a, __b, 5269 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5270 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5271 0x06, 0x16, 0x07, 0x17)); 5272 } 5273 5274 /* vec_vmrghh */ 5275 5276 #define __builtin_altivec_vmrghh vec_vmrghh 5277 5278 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 5279 vector short __b) { 5280 return vec_perm(__a, __b, 5281 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5282 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5283 0x06, 0x07, 0x16, 0x17)); 5284 } 5285 5286 static __inline__ vector unsigned short __ATTRS_o_ai 5287 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 5288 return vec_perm(__a, __b, 5289 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5290 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5291 0x06, 0x07, 0x16, 0x17)); 5292 } 5293 5294 static __inline__ vector bool short __ATTRS_o_ai 5295 vec_vmrghh(vector bool short __a, vector bool short __b) { 5296 return vec_perm(__a, __b, 5297 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5298 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5299 0x06, 0x07, 0x16, 0x17)); 5300 } 5301 5302 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 5303 vector pixel __b) { 5304 return vec_perm(__a, __b, 5305 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5306 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5307 0x06, 0x07, 0x16, 0x17)); 5308 } 5309 5310 /* vec_vmrghw */ 5311 5312 #define __builtin_altivec_vmrghw vec_vmrghw 5313 5314 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 5315 vector int __b) { 5316 return vec_perm(__a, __b, 5317 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5318 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5319 0x14, 0x15, 0x16, 0x17)); 5320 } 5321 5322 static __inline__ vector unsigned int __ATTRS_o_ai 5323 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 5324 return vec_perm(__a, __b, 5325 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5326 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5327 0x14, 0x15, 0x16, 0x17)); 5328 } 5329 5330 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 5331 vector bool int __b) { 5332 return vec_perm(__a, __b, 5333 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5334 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5335 0x14, 0x15, 0x16, 0x17)); 5336 } 5337 5338 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 5339 vector float __b) { 5340 return vec_perm(__a, __b, 5341 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5342 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5343 0x14, 0x15, 0x16, 0x17)); 5344 } 5345 5346 /* vec_mergel */ 5347 5348 static __inline__ vector signed char __ATTRS_o_ai 5349 vec_mergel(vector signed char __a, vector signed char __b) { 5350 return vec_perm(__a, __b, 5351 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5352 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5353 0x0E, 0x1E, 0x0F, 0x1F)); 5354 } 5355 5356 static __inline__ vector unsigned char __ATTRS_o_ai 5357 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 5358 return vec_perm(__a, __b, 5359 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5360 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5361 0x0E, 0x1E, 0x0F, 0x1F)); 5362 } 5363 5364 static __inline__ vector bool char __ATTRS_o_ai 5365 vec_mergel(vector bool char __a, vector bool char __b) { 5366 return vec_perm(__a, __b, 5367 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5368 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5369 0x0E, 0x1E, 0x0F, 0x1F)); 5370 } 5371 5372 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 5373 vector short __b) { 5374 return vec_perm(__a, __b, 5375 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5376 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5377 0x0E, 0x0F, 0x1E, 0x1F)); 5378 } 5379 5380 static __inline__ vector unsigned short __ATTRS_o_ai 5381 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 5382 return vec_perm(__a, __b, 5383 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5384 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5385 0x0E, 0x0F, 0x1E, 0x1F)); 5386 } 5387 5388 static __inline__ vector bool short __ATTRS_o_ai 5389 vec_mergel(vector bool short __a, vector bool short __b) { 5390 return vec_perm(__a, __b, 5391 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5392 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5393 0x0E, 0x0F, 0x1E, 0x1F)); 5394 } 5395 5396 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 5397 vector pixel __b) { 5398 return vec_perm(__a, __b, 5399 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5400 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5401 0x0E, 0x0F, 0x1E, 0x1F)); 5402 } 5403 5404 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 5405 vector int __b) { 5406 return vec_perm(__a, __b, 5407 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5408 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5409 0x1C, 0x1D, 0x1E, 0x1F)); 5410 } 5411 5412 static __inline__ vector unsigned int __ATTRS_o_ai 5413 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 5414 return vec_perm(__a, __b, 5415 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5416 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5417 0x1C, 0x1D, 0x1E, 0x1F)); 5418 } 5419 5420 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 5421 vector bool int __b) { 5422 return vec_perm(__a, __b, 5423 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5424 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5425 0x1C, 0x1D, 0x1E, 0x1F)); 5426 } 5427 5428 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 5429 vector float __b) { 5430 return vec_perm(__a, __b, 5431 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5432 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5433 0x1C, 0x1D, 0x1E, 0x1F)); 5434 } 5435 5436 #ifdef __VSX__ 5437 static __inline__ vector signed long long __ATTRS_o_ai 5438 vec_mergel(vector signed long long __a, vector signed long long __b) { 5439 return vec_perm(__a, __b, 5440 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5441 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5442 0x1C, 0x1D, 0x1E, 0x1F)); 5443 } 5444 static __inline__ vector signed long long __ATTRS_o_ai 5445 vec_mergel(vector signed long long __a, vector bool long long __b) { 5446 return vec_perm(__a, (vector signed long long)__b, 5447 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5448 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5449 0x1C, 0x1D, 0x1E, 0x1F)); 5450 } 5451 static __inline__ vector signed long long __ATTRS_o_ai 5452 vec_mergel(vector bool long long __a, vector signed long long __b) { 5453 return vec_perm((vector signed long long)__a, __b, 5454 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5455 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5456 0x1C, 0x1D, 0x1E, 0x1F)); 5457 } 5458 static __inline__ vector unsigned long long __ATTRS_o_ai 5459 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 5460 return vec_perm(__a, __b, 5461 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5462 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5463 0x1C, 0x1D, 0x1E, 0x1F)); 5464 } 5465 static __inline__ vector unsigned long long __ATTRS_o_ai 5466 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 5467 return vec_perm(__a, (vector unsigned long long)__b, 5468 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5469 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5470 0x1C, 0x1D, 0x1E, 0x1F)); 5471 } 5472 static __inline__ vector unsigned long long __ATTRS_o_ai 5473 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 5474 return vec_perm((vector unsigned long long)__a, __b, 5475 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5476 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5477 0x1C, 0x1D, 0x1E, 0x1F)); 5478 } 5479 static __inline__ vector bool long long __ATTRS_o_ai 5480 vec_mergel(vector bool long long __a, vector bool long long __b) { 5481 return vec_perm(__a, __b, 5482 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5483 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5484 0x1C, 0x1D, 0x1E, 0x1F)); 5485 } 5486 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 5487 vector double __b) { 5488 return vec_perm(__a, __b, 5489 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5490 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5491 0x1C, 0x1D, 0x1E, 0x1F)); 5492 } 5493 static __inline__ vector double __ATTRS_o_ai 5494 vec_mergel(vector double __a, vector bool long long __b) { 5495 return vec_perm(__a, (vector double)__b, 5496 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5497 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5498 0x1C, 0x1D, 0x1E, 0x1F)); 5499 } 5500 static __inline__ vector double __ATTRS_o_ai 5501 vec_mergel(vector bool long long __a, vector double __b) { 5502 return vec_perm((vector double)__a, __b, 5503 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5504 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5505 0x1C, 0x1D, 0x1E, 0x1F)); 5506 } 5507 #endif 5508 5509 /* vec_vmrglb */ 5510 5511 #define __builtin_altivec_vmrglb vec_vmrglb 5512 5513 static __inline__ vector signed char __ATTRS_o_ai 5514 vec_vmrglb(vector signed char __a, vector signed char __b) { 5515 return vec_perm(__a, __b, 5516 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5517 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5518 0x0E, 0x1E, 0x0F, 0x1F)); 5519 } 5520 5521 static __inline__ vector unsigned char __ATTRS_o_ai 5522 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 5523 return vec_perm(__a, __b, 5524 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5525 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5526 0x0E, 0x1E, 0x0F, 0x1F)); 5527 } 5528 5529 static __inline__ vector bool char __ATTRS_o_ai 5530 vec_vmrglb(vector bool char __a, vector bool char __b) { 5531 return vec_perm(__a, __b, 5532 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5533 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5534 0x0E, 0x1E, 0x0F, 0x1F)); 5535 } 5536 5537 /* vec_vmrglh */ 5538 5539 #define __builtin_altivec_vmrglh vec_vmrglh 5540 5541 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 5542 vector short __b) { 5543 return vec_perm(__a, __b, 5544 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5545 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5546 0x0E, 0x0F, 0x1E, 0x1F)); 5547 } 5548 5549 static __inline__ vector unsigned short __ATTRS_o_ai 5550 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5551 return vec_perm(__a, __b, 5552 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5553 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5554 0x0E, 0x0F, 0x1E, 0x1F)); 5555 } 5556 5557 static __inline__ vector bool short __ATTRS_o_ai 5558 vec_vmrglh(vector bool short __a, vector bool short __b) { 5559 return vec_perm(__a, __b, 5560 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5561 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5562 0x0E, 0x0F, 0x1E, 0x1F)); 5563 } 5564 5565 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5566 vector pixel __b) { 5567 return vec_perm(__a, __b, 5568 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5569 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5570 0x0E, 0x0F, 0x1E, 0x1F)); 5571 } 5572 5573 /* vec_vmrglw */ 5574 5575 #define __builtin_altivec_vmrglw vec_vmrglw 5576 5577 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5578 vector int __b) { 5579 return vec_perm(__a, __b, 5580 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5581 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5582 0x1C, 0x1D, 0x1E, 0x1F)); 5583 } 5584 5585 static __inline__ vector unsigned int __ATTRS_o_ai 5586 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5587 return vec_perm(__a, __b, 5588 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5589 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5590 0x1C, 0x1D, 0x1E, 0x1F)); 5591 } 5592 5593 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5594 vector bool int __b) { 5595 return vec_perm(__a, __b, 5596 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5597 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5598 0x1C, 0x1D, 0x1E, 0x1F)); 5599 } 5600 5601 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5602 vector float __b) { 5603 return vec_perm(__a, __b, 5604 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5605 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5606 0x1C, 0x1D, 0x1E, 0x1F)); 5607 } 5608 5609 #ifdef __POWER8_VECTOR__ 5610 /* vec_mergee */ 5611 5612 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5613 vector bool int __b) { 5614 return vec_perm(__a, __b, 5615 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5616 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5617 0x18, 0x19, 0x1A, 0x1B)); 5618 } 5619 5620 static __inline__ vector signed int __ATTRS_o_ai 5621 vec_mergee(vector signed int __a, vector signed int __b) { 5622 return vec_perm(__a, __b, 5623 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5624 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5625 0x18, 0x19, 0x1A, 0x1B)); 5626 } 5627 5628 static __inline__ vector unsigned int __ATTRS_o_ai 5629 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5630 return vec_perm(__a, __b, 5631 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5632 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5633 0x18, 0x19, 0x1A, 0x1B)); 5634 } 5635 5636 static __inline__ vector bool long long __ATTRS_o_ai 5637 vec_mergee(vector bool long long __a, vector bool long long __b) { 5638 return vec_mergeh(__a, __b); 5639 } 5640 5641 static __inline__ vector signed long long __ATTRS_o_ai 5642 vec_mergee(vector signed long long __a, vector signed long long __b) { 5643 return vec_mergeh(__a, __b); 5644 } 5645 5646 static __inline__ vector unsigned long long __ATTRS_o_ai 5647 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5648 return vec_mergeh(__a, __b); 5649 } 5650 5651 static __inline__ vector float __ATTRS_o_ai 5652 vec_mergee(vector float __a, vector float __b) { 5653 return vec_perm(__a, __b, 5654 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5655 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5656 0x18, 0x19, 0x1A, 0x1B)); 5657 } 5658 5659 static __inline__ vector double __ATTRS_o_ai 5660 vec_mergee(vector double __a, vector double __b) { 5661 return vec_mergeh(__a, __b); 5662 } 5663 5664 /* vec_mergeo */ 5665 5666 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5667 vector bool int __b) { 5668 return vec_perm(__a, __b, 5669 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5670 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5671 0x1C, 0x1D, 0x1E, 0x1F)); 5672 } 5673 5674 static __inline__ vector signed int __ATTRS_o_ai 5675 vec_mergeo(vector signed int __a, vector signed int __b) { 5676 return vec_perm(__a, __b, 5677 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5678 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5679 0x1C, 0x1D, 0x1E, 0x1F)); 5680 } 5681 5682 static __inline__ vector unsigned int __ATTRS_o_ai 5683 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5684 return vec_perm(__a, __b, 5685 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5686 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5687 0x1C, 0x1D, 0x1E, 0x1F)); 5688 } 5689 5690 static __inline__ vector bool long long __ATTRS_o_ai 5691 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5692 return vec_mergel(__a, __b); 5693 } 5694 5695 static __inline__ vector signed long long __ATTRS_o_ai 5696 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5697 return vec_mergel(__a, __b); 5698 } 5699 5700 static __inline__ vector unsigned long long __ATTRS_o_ai 5701 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5702 return vec_mergel(__a, __b); 5703 } 5704 5705 static __inline__ vector float __ATTRS_o_ai 5706 vec_mergeo(vector float __a, vector float __b) { 5707 return vec_perm(__a, __b, 5708 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5709 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5710 0x1C, 0x1D, 0x1E, 0x1F)); 5711 } 5712 5713 static __inline__ vector double __ATTRS_o_ai 5714 vec_mergeo(vector double __a, vector double __b) { 5715 return vec_mergel(__a, __b); 5716 } 5717 5718 #endif 5719 5720 /* vec_mfvscr */ 5721 5722 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5723 vec_mfvscr(void) { 5724 return __builtin_altivec_mfvscr(); 5725 } 5726 5727 /* vec_min */ 5728 5729 static __inline__ vector signed char __ATTRS_o_ai 5730 vec_min(vector signed char __a, vector signed char __b) { 5731 return __builtin_altivec_vminsb(__a, __b); 5732 } 5733 5734 static __inline__ vector signed char __ATTRS_o_ai 5735 vec_min(vector bool char __a, vector signed char __b) { 5736 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5737 } 5738 5739 static __inline__ vector signed char __ATTRS_o_ai 5740 vec_min(vector signed char __a, vector bool char __b) { 5741 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5742 } 5743 5744 static __inline__ vector unsigned char __ATTRS_o_ai 5745 vec_min(vector unsigned char __a, vector unsigned char __b) { 5746 return __builtin_altivec_vminub(__a, __b); 5747 } 5748 5749 static __inline__ vector unsigned char __ATTRS_o_ai 5750 vec_min(vector bool char __a, vector unsigned char __b) { 5751 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5752 } 5753 5754 static __inline__ vector unsigned char __ATTRS_o_ai 5755 vec_min(vector unsigned char __a, vector bool char __b) { 5756 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5757 } 5758 5759 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5760 vector short __b) { 5761 return __builtin_altivec_vminsh(__a, __b); 5762 } 5763 5764 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5765 vector short __b) { 5766 return __builtin_altivec_vminsh((vector short)__a, __b); 5767 } 5768 5769 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5770 vector bool short __b) { 5771 return __builtin_altivec_vminsh(__a, (vector short)__b); 5772 } 5773 5774 static __inline__ vector unsigned short __ATTRS_o_ai 5775 vec_min(vector unsigned short __a, vector unsigned short __b) { 5776 return __builtin_altivec_vminuh(__a, __b); 5777 } 5778 5779 static __inline__ vector unsigned short __ATTRS_o_ai 5780 vec_min(vector bool short __a, vector unsigned short __b) { 5781 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5782 } 5783 5784 static __inline__ vector unsigned short __ATTRS_o_ai 5785 vec_min(vector unsigned short __a, vector bool short __b) { 5786 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5787 } 5788 5789 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5790 vector int __b) { 5791 return __builtin_altivec_vminsw(__a, __b); 5792 } 5793 5794 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5795 vector int __b) { 5796 return __builtin_altivec_vminsw((vector int)__a, __b); 5797 } 5798 5799 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5800 vector bool int __b) { 5801 return __builtin_altivec_vminsw(__a, (vector int)__b); 5802 } 5803 5804 static __inline__ vector unsigned int __ATTRS_o_ai 5805 vec_min(vector unsigned int __a, vector unsigned int __b) { 5806 return __builtin_altivec_vminuw(__a, __b); 5807 } 5808 5809 static __inline__ vector unsigned int __ATTRS_o_ai 5810 vec_min(vector bool int __a, vector unsigned int __b) { 5811 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5812 } 5813 5814 static __inline__ vector unsigned int __ATTRS_o_ai 5815 vec_min(vector unsigned int __a, vector bool int __b) { 5816 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5817 } 5818 5819 #ifdef __POWER8_VECTOR__ 5820 static __inline__ vector signed long long __ATTRS_o_ai 5821 vec_min(vector signed long long __a, vector signed long long __b) { 5822 return __builtin_altivec_vminsd(__a, __b); 5823 } 5824 5825 static __inline__ vector signed long long __ATTRS_o_ai 5826 vec_min(vector bool long long __a, vector signed long long __b) { 5827 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5828 } 5829 5830 static __inline__ vector signed long long __ATTRS_o_ai 5831 vec_min(vector signed long long __a, vector bool long long __b) { 5832 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5833 } 5834 5835 static __inline__ vector unsigned long long __ATTRS_o_ai 5836 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5837 return __builtin_altivec_vminud(__a, __b); 5838 } 5839 5840 static __inline__ vector unsigned long long __ATTRS_o_ai 5841 vec_min(vector bool long long __a, vector unsigned long long __b) { 5842 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5843 } 5844 5845 static __inline__ vector unsigned long long __ATTRS_o_ai 5846 vec_min(vector unsigned long long __a, vector bool long long __b) { 5847 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5848 } 5849 #endif 5850 5851 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5852 vector float __b) { 5853 #ifdef __VSX__ 5854 return __builtin_vsx_xvminsp(__a, __b); 5855 #else 5856 return __builtin_altivec_vminfp(__a, __b); 5857 #endif 5858 } 5859 5860 #ifdef __VSX__ 5861 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5862 vector double __b) { 5863 return __builtin_vsx_xvmindp(__a, __b); 5864 } 5865 #endif 5866 5867 /* vec_vminsb */ 5868 5869 static __inline__ vector signed char __ATTRS_o_ai 5870 vec_vminsb(vector signed char __a, vector signed char __b) { 5871 return __builtin_altivec_vminsb(__a, __b); 5872 } 5873 5874 static __inline__ vector signed char __ATTRS_o_ai 5875 vec_vminsb(vector bool char __a, vector signed char __b) { 5876 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5877 } 5878 5879 static __inline__ vector signed char __ATTRS_o_ai 5880 vec_vminsb(vector signed char __a, vector bool char __b) { 5881 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5882 } 5883 5884 /* vec_vminub */ 5885 5886 static __inline__ vector unsigned char __ATTRS_o_ai 5887 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5888 return __builtin_altivec_vminub(__a, __b); 5889 } 5890 5891 static __inline__ vector unsigned char __ATTRS_o_ai 5892 vec_vminub(vector bool char __a, vector unsigned char __b) { 5893 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5894 } 5895 5896 static __inline__ vector unsigned char __ATTRS_o_ai 5897 vec_vminub(vector unsigned char __a, vector bool char __b) { 5898 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5899 } 5900 5901 /* vec_vminsh */ 5902 5903 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5904 vector short __b) { 5905 return __builtin_altivec_vminsh(__a, __b); 5906 } 5907 5908 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5909 vector short __b) { 5910 return __builtin_altivec_vminsh((vector short)__a, __b); 5911 } 5912 5913 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5914 vector bool short __b) { 5915 return __builtin_altivec_vminsh(__a, (vector short)__b); 5916 } 5917 5918 /* vec_vminuh */ 5919 5920 static __inline__ vector unsigned short __ATTRS_o_ai 5921 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5922 return __builtin_altivec_vminuh(__a, __b); 5923 } 5924 5925 static __inline__ vector unsigned short __ATTRS_o_ai 5926 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5927 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5928 } 5929 5930 static __inline__ vector unsigned short __ATTRS_o_ai 5931 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5932 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5933 } 5934 5935 /* vec_vminsw */ 5936 5937 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5938 vector int __b) { 5939 return __builtin_altivec_vminsw(__a, __b); 5940 } 5941 5942 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5943 vector int __b) { 5944 return __builtin_altivec_vminsw((vector int)__a, __b); 5945 } 5946 5947 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5948 vector bool int __b) { 5949 return __builtin_altivec_vminsw(__a, (vector int)__b); 5950 } 5951 5952 /* vec_vminuw */ 5953 5954 static __inline__ vector unsigned int __ATTRS_o_ai 5955 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5956 return __builtin_altivec_vminuw(__a, __b); 5957 } 5958 5959 static __inline__ vector unsigned int __ATTRS_o_ai 5960 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5961 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5962 } 5963 5964 static __inline__ vector unsigned int __ATTRS_o_ai 5965 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5966 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5967 } 5968 5969 /* vec_vminfp */ 5970 5971 static __inline__ vector float __attribute__((__always_inline__)) 5972 vec_vminfp(vector float __a, vector float __b) { 5973 #ifdef __VSX__ 5974 return __builtin_vsx_xvminsp(__a, __b); 5975 #else 5976 return __builtin_altivec_vminfp(__a, __b); 5977 #endif 5978 } 5979 5980 /* vec_mladd */ 5981 5982 #define __builtin_altivec_vmladduhm vec_mladd 5983 5984 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5985 vector short __b, 5986 vector short __c) { 5987 return __a * __b + __c; 5988 } 5989 5990 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5991 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5992 return __a * (vector short)__b + (vector short)__c; 5993 } 5994 5995 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5996 vector short __b, 5997 vector short __c) { 5998 return (vector short)__a * __b + __c; 5999 } 6000 6001 static __inline__ vector unsigned short __ATTRS_o_ai 6002 vec_mladd(vector unsigned short __a, vector unsigned short __b, 6003 vector unsigned short __c) { 6004 return __a * __b + __c; 6005 } 6006 6007 /* vec_vmladduhm */ 6008 6009 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 6010 vector short __b, 6011 vector short __c) { 6012 return __a * __b + __c; 6013 } 6014 6015 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 6016 vector short __a, vector unsigned short __b, vector unsigned short __c) { 6017 return __a * (vector short)__b + (vector short)__c; 6018 } 6019 6020 static __inline__ vector short __ATTRS_o_ai 6021 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 6022 return (vector short)__a * __b + __c; 6023 } 6024 6025 static __inline__ vector unsigned short __ATTRS_o_ai 6026 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 6027 vector unsigned short __c) { 6028 return __a * __b + __c; 6029 } 6030 6031 /* vec_mradds */ 6032 6033 static __inline__ vector short __attribute__((__always_inline__)) 6034 vec_mradds(vector short __a, vector short __b, vector short __c) { 6035 return __builtin_altivec_vmhraddshs(__a, __b, __c); 6036 } 6037 6038 /* vec_vmhraddshs */ 6039 6040 static __inline__ vector short __attribute__((__always_inline__)) 6041 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 6042 return __builtin_altivec_vmhraddshs(__a, __b, __c); 6043 } 6044 6045 /* vec_msum */ 6046 6047 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 6048 vector unsigned char __b, 6049 vector int __c) { 6050 return __builtin_altivec_vmsummbm(__a, __b, __c); 6051 } 6052 6053 static __inline__ vector unsigned int __ATTRS_o_ai 6054 vec_msum(vector unsigned char __a, vector unsigned char __b, 6055 vector unsigned int __c) { 6056 return __builtin_altivec_vmsumubm(__a, __b, __c); 6057 } 6058 6059 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 6060 vector short __b, 6061 vector int __c) { 6062 return __builtin_altivec_vmsumshm(__a, __b, __c); 6063 } 6064 6065 static __inline__ vector unsigned int __ATTRS_o_ai 6066 vec_msum(vector unsigned short __a, vector unsigned short __b, 6067 vector unsigned int __c) { 6068 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6069 } 6070 6071 /* vec_msumc */ 6072 6073 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6074 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6075 vec_msumc(vector unsigned long long __a, vector unsigned long long __b, 6076 vector unsigned __int128 __c) { 6077 return __builtin_altivec_vmsumcud(__a, __b, __c); 6078 } 6079 #endif 6080 6081 /* vec_vmsummbm */ 6082 6083 static __inline__ vector int __attribute__((__always_inline__)) 6084 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 6085 return __builtin_altivec_vmsummbm(__a, __b, __c); 6086 } 6087 6088 /* vec_vmsumubm */ 6089 6090 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6091 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 6092 vector unsigned int __c) { 6093 return __builtin_altivec_vmsumubm(__a, __b, __c); 6094 } 6095 6096 /* vec_vmsumshm */ 6097 6098 static __inline__ vector int __attribute__((__always_inline__)) 6099 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 6100 return __builtin_altivec_vmsumshm(__a, __b, __c); 6101 } 6102 6103 /* vec_vmsumuhm */ 6104 6105 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6106 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 6107 vector unsigned int __c) { 6108 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6109 } 6110 6111 /* vec_msums */ 6112 6113 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 6114 vector short __b, 6115 vector int __c) { 6116 return __builtin_altivec_vmsumshs(__a, __b, __c); 6117 } 6118 6119 static __inline__ vector unsigned int __ATTRS_o_ai 6120 vec_msums(vector unsigned short __a, vector unsigned short __b, 6121 vector unsigned int __c) { 6122 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6123 } 6124 6125 /* vec_vmsumshs */ 6126 6127 static __inline__ vector int __attribute__((__always_inline__)) 6128 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 6129 return __builtin_altivec_vmsumshs(__a, __b, __c); 6130 } 6131 6132 /* vec_vmsumuhs */ 6133 6134 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6135 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 6136 vector unsigned int __c) { 6137 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6138 } 6139 6140 /* vec_mtvscr */ 6141 6142 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 6143 __builtin_altivec_mtvscr((vector int)__a); 6144 } 6145 6146 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 6147 __builtin_altivec_mtvscr((vector int)__a); 6148 } 6149 6150 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 6151 __builtin_altivec_mtvscr((vector int)__a); 6152 } 6153 6154 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 6155 __builtin_altivec_mtvscr((vector int)__a); 6156 } 6157 6158 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 6159 __builtin_altivec_mtvscr((vector int)__a); 6160 } 6161 6162 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 6163 __builtin_altivec_mtvscr((vector int)__a); 6164 } 6165 6166 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 6167 __builtin_altivec_mtvscr((vector int)__a); 6168 } 6169 6170 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 6171 __builtin_altivec_mtvscr((vector int)__a); 6172 } 6173 6174 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 6175 __builtin_altivec_mtvscr((vector int)__a); 6176 } 6177 6178 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 6179 __builtin_altivec_mtvscr((vector int)__a); 6180 } 6181 6182 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 6183 __builtin_altivec_mtvscr((vector int)__a); 6184 } 6185 6186 /* vec_mul */ 6187 6188 /* Integer vector multiplication will involve multiplication of the odd/even 6189 elements separately, then truncating the results and moving to the 6190 result vector. 6191 */ 6192 static __inline__ vector signed char __ATTRS_o_ai 6193 vec_mul(vector signed char __a, vector signed char __b) { 6194 return __a * __b; 6195 } 6196 6197 static __inline__ vector unsigned char __ATTRS_o_ai 6198 vec_mul(vector unsigned char __a, vector unsigned char __b) { 6199 return __a * __b; 6200 } 6201 6202 static __inline__ vector signed short __ATTRS_o_ai 6203 vec_mul(vector signed short __a, vector signed short __b) { 6204 return __a * __b; 6205 } 6206 6207 static __inline__ vector unsigned short __ATTRS_o_ai 6208 vec_mul(vector unsigned short __a, vector unsigned short __b) { 6209 return __a * __b; 6210 } 6211 6212 static __inline__ vector signed int __ATTRS_o_ai 6213 vec_mul(vector signed int __a, vector signed int __b) { 6214 return __a * __b; 6215 } 6216 6217 static __inline__ vector unsigned int __ATTRS_o_ai 6218 vec_mul(vector unsigned int __a, vector unsigned int __b) { 6219 return __a * __b; 6220 } 6221 6222 #ifdef __VSX__ 6223 static __inline__ vector signed long long __ATTRS_o_ai 6224 vec_mul(vector signed long long __a, vector signed long long __b) { 6225 return __a * __b; 6226 } 6227 6228 static __inline__ vector unsigned long long __ATTRS_o_ai 6229 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 6230 return __a * __b; 6231 } 6232 #endif 6233 6234 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 6235 vector float __b) { 6236 return __a * __b; 6237 } 6238 6239 #ifdef __VSX__ 6240 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 6241 vector double __b) { 6242 return __a * __b; 6243 } 6244 #endif 6245 6246 /* The vmulos* and vmules* instructions have a big endian bias, so 6247 we must reverse the meaning of "even" and "odd" for little endian. */ 6248 6249 /* vec_mule */ 6250 6251 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 6252 vector signed char __b) { 6253 #ifdef __LITTLE_ENDIAN__ 6254 return __builtin_altivec_vmulosb(__a, __b); 6255 #else 6256 return __builtin_altivec_vmulesb(__a, __b); 6257 #endif 6258 } 6259 6260 static __inline__ vector unsigned short __ATTRS_o_ai 6261 vec_mule(vector unsigned char __a, vector unsigned char __b) { 6262 #ifdef __LITTLE_ENDIAN__ 6263 return __builtin_altivec_vmuloub(__a, __b); 6264 #else 6265 return __builtin_altivec_vmuleub(__a, __b); 6266 #endif 6267 } 6268 6269 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 6270 vector short __b) { 6271 #ifdef __LITTLE_ENDIAN__ 6272 return __builtin_altivec_vmulosh(__a, __b); 6273 #else 6274 return __builtin_altivec_vmulesh(__a, __b); 6275 #endif 6276 } 6277 6278 static __inline__ vector unsigned int __ATTRS_o_ai 6279 vec_mule(vector unsigned short __a, vector unsigned short __b) { 6280 #ifdef __LITTLE_ENDIAN__ 6281 return __builtin_altivec_vmulouh(__a, __b); 6282 #else 6283 return __builtin_altivec_vmuleuh(__a, __b); 6284 #endif 6285 } 6286 6287 #ifdef __POWER8_VECTOR__ 6288 static __inline__ vector signed long long __ATTRS_o_ai 6289 vec_mule(vector signed int __a, vector signed int __b) { 6290 #ifdef __LITTLE_ENDIAN__ 6291 return __builtin_altivec_vmulosw(__a, __b); 6292 #else 6293 return __builtin_altivec_vmulesw(__a, __b); 6294 #endif 6295 } 6296 6297 static __inline__ vector unsigned long long __ATTRS_o_ai 6298 vec_mule(vector unsigned int __a, vector unsigned int __b) { 6299 #ifdef __LITTLE_ENDIAN__ 6300 return __builtin_altivec_vmulouw(__a, __b); 6301 #else 6302 return __builtin_altivec_vmuleuw(__a, __b); 6303 #endif 6304 } 6305 #endif 6306 6307 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6308 static __inline__ vector signed __int128 __ATTRS_o_ai 6309 vec_mule(vector signed long long __a, vector signed long long __b) { 6310 #ifdef __LITTLE_ENDIAN__ 6311 return __builtin_altivec_vmulosd(__a, __b); 6312 #else 6313 return __builtin_altivec_vmulesd(__a, __b); 6314 #endif 6315 } 6316 6317 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6318 vec_mule(vector unsigned long long __a, vector unsigned long long __b) { 6319 #ifdef __LITTLE_ENDIAN__ 6320 return __builtin_altivec_vmuloud(__a, __b); 6321 #else 6322 return __builtin_altivec_vmuleud(__a, __b); 6323 #endif 6324 } 6325 #endif 6326 6327 /* vec_vmulesb */ 6328 6329 static __inline__ vector short __attribute__((__always_inline__)) 6330 vec_vmulesb(vector signed char __a, vector signed char __b) { 6331 #ifdef __LITTLE_ENDIAN__ 6332 return __builtin_altivec_vmulosb(__a, __b); 6333 #else 6334 return __builtin_altivec_vmulesb(__a, __b); 6335 #endif 6336 } 6337 6338 /* vec_vmuleub */ 6339 6340 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6341 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 6342 #ifdef __LITTLE_ENDIAN__ 6343 return __builtin_altivec_vmuloub(__a, __b); 6344 #else 6345 return __builtin_altivec_vmuleub(__a, __b); 6346 #endif 6347 } 6348 6349 /* vec_vmulesh */ 6350 6351 static __inline__ vector int __attribute__((__always_inline__)) 6352 vec_vmulesh(vector short __a, vector short __b) { 6353 #ifdef __LITTLE_ENDIAN__ 6354 return __builtin_altivec_vmulosh(__a, __b); 6355 #else 6356 return __builtin_altivec_vmulesh(__a, __b); 6357 #endif 6358 } 6359 6360 /* vec_vmuleuh */ 6361 6362 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6363 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 6364 #ifdef __LITTLE_ENDIAN__ 6365 return __builtin_altivec_vmulouh(__a, __b); 6366 #else 6367 return __builtin_altivec_vmuleuh(__a, __b); 6368 #endif 6369 } 6370 6371 /* vec_mulh */ 6372 6373 #ifdef __POWER10_VECTOR__ 6374 static __inline__ vector signed int __ATTRS_o_ai 6375 vec_mulh(vector signed int __a, vector signed int __b) { 6376 return __builtin_altivec_vmulhsw(__a, __b); 6377 } 6378 6379 static __inline__ vector unsigned int __ATTRS_o_ai 6380 vec_mulh(vector unsigned int __a, vector unsigned int __b) { 6381 return __builtin_altivec_vmulhuw(__a, __b); 6382 } 6383 6384 static __inline__ vector signed long long __ATTRS_o_ai 6385 vec_mulh(vector signed long long __a, vector signed long long __b) { 6386 return __builtin_altivec_vmulhsd(__a, __b); 6387 } 6388 6389 static __inline__ vector unsigned long long __ATTRS_o_ai 6390 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { 6391 return __builtin_altivec_vmulhud(__a, __b); 6392 } 6393 #endif 6394 6395 /* vec_mulo */ 6396 6397 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 6398 vector signed char __b) { 6399 #ifdef __LITTLE_ENDIAN__ 6400 return __builtin_altivec_vmulesb(__a, __b); 6401 #else 6402 return __builtin_altivec_vmulosb(__a, __b); 6403 #endif 6404 } 6405 6406 static __inline__ vector unsigned short __ATTRS_o_ai 6407 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 6408 #ifdef __LITTLE_ENDIAN__ 6409 return __builtin_altivec_vmuleub(__a, __b); 6410 #else 6411 return __builtin_altivec_vmuloub(__a, __b); 6412 #endif 6413 } 6414 6415 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 6416 vector short __b) { 6417 #ifdef __LITTLE_ENDIAN__ 6418 return __builtin_altivec_vmulesh(__a, __b); 6419 #else 6420 return __builtin_altivec_vmulosh(__a, __b); 6421 #endif 6422 } 6423 6424 static __inline__ vector unsigned int __ATTRS_o_ai 6425 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 6426 #ifdef __LITTLE_ENDIAN__ 6427 return __builtin_altivec_vmuleuh(__a, __b); 6428 #else 6429 return __builtin_altivec_vmulouh(__a, __b); 6430 #endif 6431 } 6432 6433 #ifdef __POWER8_VECTOR__ 6434 static __inline__ vector signed long long __ATTRS_o_ai 6435 vec_mulo(vector signed int __a, vector signed int __b) { 6436 #ifdef __LITTLE_ENDIAN__ 6437 return __builtin_altivec_vmulesw(__a, __b); 6438 #else 6439 return __builtin_altivec_vmulosw(__a, __b); 6440 #endif 6441 } 6442 6443 static __inline__ vector unsigned long long __ATTRS_o_ai 6444 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 6445 #ifdef __LITTLE_ENDIAN__ 6446 return __builtin_altivec_vmuleuw(__a, __b); 6447 #else 6448 return __builtin_altivec_vmulouw(__a, __b); 6449 #endif 6450 } 6451 #endif 6452 6453 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6454 static __inline__ vector signed __int128 __ATTRS_o_ai 6455 vec_mulo(vector signed long long __a, vector signed long long __b) { 6456 #ifdef __LITTLE_ENDIAN__ 6457 return __builtin_altivec_vmulesd(__a, __b); 6458 #else 6459 return __builtin_altivec_vmulosd(__a, __b); 6460 #endif 6461 } 6462 6463 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6464 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { 6465 #ifdef __LITTLE_ENDIAN__ 6466 return __builtin_altivec_vmuleud(__a, __b); 6467 #else 6468 return __builtin_altivec_vmuloud(__a, __b); 6469 #endif 6470 } 6471 #endif 6472 6473 /* vec_vmulosb */ 6474 6475 static __inline__ vector short __attribute__((__always_inline__)) 6476 vec_vmulosb(vector signed char __a, vector signed char __b) { 6477 #ifdef __LITTLE_ENDIAN__ 6478 return __builtin_altivec_vmulesb(__a, __b); 6479 #else 6480 return __builtin_altivec_vmulosb(__a, __b); 6481 #endif 6482 } 6483 6484 /* vec_vmuloub */ 6485 6486 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6487 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 6488 #ifdef __LITTLE_ENDIAN__ 6489 return __builtin_altivec_vmuleub(__a, __b); 6490 #else 6491 return __builtin_altivec_vmuloub(__a, __b); 6492 #endif 6493 } 6494 6495 /* vec_vmulosh */ 6496 6497 static __inline__ vector int __attribute__((__always_inline__)) 6498 vec_vmulosh(vector short __a, vector short __b) { 6499 #ifdef __LITTLE_ENDIAN__ 6500 return __builtin_altivec_vmulesh(__a, __b); 6501 #else 6502 return __builtin_altivec_vmulosh(__a, __b); 6503 #endif 6504 } 6505 6506 /* vec_vmulouh */ 6507 6508 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6509 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 6510 #ifdef __LITTLE_ENDIAN__ 6511 return __builtin_altivec_vmuleuh(__a, __b); 6512 #else 6513 return __builtin_altivec_vmulouh(__a, __b); 6514 #endif 6515 } 6516 6517 /* vec_nand */ 6518 6519 #ifdef __POWER8_VECTOR__ 6520 static __inline__ vector signed char __ATTRS_o_ai 6521 vec_nand(vector signed char __a, vector signed char __b) { 6522 return ~(__a & __b); 6523 } 6524 6525 static __inline__ vector signed char __ATTRS_o_ai 6526 vec_nand(vector signed char __a, vector bool char __b) { 6527 return ~(__a & (vector signed char)__b); 6528 } 6529 6530 static __inline__ vector signed char __ATTRS_o_ai 6531 vec_nand(vector bool char __a, vector signed char __b) { 6532 return (vector signed char)~(__a & (vector bool char)__b); 6533 } 6534 6535 static __inline__ vector unsigned char __ATTRS_o_ai 6536 vec_nand(vector unsigned char __a, vector unsigned char __b) { 6537 return ~(__a & __b); 6538 } 6539 6540 static __inline__ vector unsigned char __ATTRS_o_ai 6541 vec_nand(vector unsigned char __a, vector bool char __b) { 6542 return ~(__a & (vector unsigned char)__b); 6543 } 6544 6545 static __inline__ vector unsigned char __ATTRS_o_ai 6546 vec_nand(vector bool char __a, vector unsigned char __b) { 6547 return (vector unsigned char)~(__a & (vector bool char)__b); 6548 } 6549 6550 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 6551 vector bool char __b) { 6552 return ~(__a & __b); 6553 } 6554 6555 static __inline__ vector signed short __ATTRS_o_ai 6556 vec_nand(vector signed short __a, vector signed short __b) { 6557 return ~(__a & __b); 6558 } 6559 6560 static __inline__ vector signed short __ATTRS_o_ai 6561 vec_nand(vector signed short __a, vector bool short __b) { 6562 return ~(__a & (vector signed short)__b); 6563 } 6564 6565 static __inline__ vector signed short __ATTRS_o_ai 6566 vec_nand(vector bool short __a, vector signed short __b) { 6567 return (vector signed short)~(__a & (vector bool short)__b); 6568 } 6569 6570 static __inline__ vector unsigned short __ATTRS_o_ai 6571 vec_nand(vector unsigned short __a, vector unsigned short __b) { 6572 return ~(__a & __b); 6573 } 6574 6575 static __inline__ vector unsigned short __ATTRS_o_ai 6576 vec_nand(vector unsigned short __a, vector bool short __b) { 6577 return ~(__a & (vector unsigned short)__b); 6578 } 6579 6580 static __inline__ vector bool short __ATTRS_o_ai 6581 vec_nand(vector bool short __a, vector bool short __b) { 6582 return ~(__a & __b); 6583 } 6584 6585 static __inline__ vector signed int __ATTRS_o_ai 6586 vec_nand(vector signed int __a, vector signed int __b) { 6587 return ~(__a & __b); 6588 } 6589 6590 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 6591 vector bool int __b) { 6592 return ~(__a & (vector signed int)__b); 6593 } 6594 6595 static __inline__ vector signed int __ATTRS_o_ai 6596 vec_nand(vector bool int __a, vector signed int __b) { 6597 return (vector signed int)~(__a & (vector bool int)__b); 6598 } 6599 6600 static __inline__ vector unsigned int __ATTRS_o_ai 6601 vec_nand(vector unsigned int __a, vector unsigned int __b) { 6602 return ~(__a & __b); 6603 } 6604 6605 static __inline__ vector unsigned int __ATTRS_o_ai 6606 vec_nand(vector unsigned int __a, vector bool int __b) { 6607 return ~(__a & (vector unsigned int)__b); 6608 } 6609 6610 static __inline__ vector unsigned int __ATTRS_o_ai 6611 vec_nand(vector bool int __a, vector unsigned int __b) { 6612 return (vector unsigned int)~(__a & (vector bool int)__b); 6613 } 6614 6615 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 6616 vector bool int __b) { 6617 return ~(__a & __b); 6618 } 6619 6620 static __inline__ vector float __ATTRS_o_ai 6621 vec_nand(vector float __a, vector float __b) { 6622 return (vector float)(~((vector unsigned int)__a & 6623 (vector unsigned int)__b)); 6624 } 6625 6626 static __inline__ vector signed long long __ATTRS_o_ai 6627 vec_nand(vector signed long long __a, vector signed long long __b) { 6628 return ~(__a & __b); 6629 } 6630 6631 static __inline__ vector signed long long __ATTRS_o_ai 6632 vec_nand(vector signed long long __a, vector bool long long __b) { 6633 return ~(__a & (vector signed long long)__b); 6634 } 6635 6636 static __inline__ vector signed long long __ATTRS_o_ai 6637 vec_nand(vector bool long long __a, vector signed long long __b) { 6638 return (vector signed long long)~(__a & (vector bool long long)__b); 6639 } 6640 6641 static __inline__ vector unsigned long long __ATTRS_o_ai 6642 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6643 return ~(__a & __b); 6644 } 6645 6646 static __inline__ vector unsigned long long __ATTRS_o_ai 6647 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6648 return ~(__a & (vector unsigned long long)__b); 6649 } 6650 6651 static __inline__ vector unsigned long long __ATTRS_o_ai 6652 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6653 return (vector unsigned long long)~(__a & (vector bool long long)__b); 6654 } 6655 6656 static __inline__ vector bool long long __ATTRS_o_ai 6657 vec_nand(vector bool long long __a, vector bool long long __b) { 6658 return ~(__a & __b); 6659 } 6660 6661 static __inline__ vector double __ATTRS_o_ai 6662 vec_nand(vector double __a, vector double __b) { 6663 return (vector double)(~((vector unsigned long long)__a & 6664 (vector unsigned long long)__b)); 6665 } 6666 6667 #endif 6668 6669 /* vec_nmadd */ 6670 6671 #ifdef __VSX__ 6672 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6673 vector float __b, 6674 vector float __c) { 6675 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6676 } 6677 6678 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6679 vector double __b, 6680 vector double __c) { 6681 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6682 } 6683 #endif 6684 6685 /* vec_nmsub */ 6686 6687 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6688 vector float __b, 6689 vector float __c) { 6690 #ifdef __VSX__ 6691 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6692 #else 6693 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6694 #endif 6695 } 6696 6697 #ifdef __VSX__ 6698 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6699 vector double __b, 6700 vector double __c) { 6701 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6702 } 6703 #endif 6704 6705 /* vec_vnmsubfp */ 6706 6707 static __inline__ vector float __attribute__((__always_inline__)) 6708 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6709 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6710 } 6711 6712 /* vec_nor */ 6713 6714 #define __builtin_altivec_vnor vec_nor 6715 6716 static __inline__ vector signed char __ATTRS_o_ai 6717 vec_nor(vector signed char __a, vector signed char __b) { 6718 return ~(__a | __b); 6719 } 6720 6721 static __inline__ vector unsigned char __ATTRS_o_ai 6722 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6723 return ~(__a | __b); 6724 } 6725 6726 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6727 vector bool char __b) { 6728 return ~(__a | __b); 6729 } 6730 6731 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6732 vector short __b) { 6733 return ~(__a | __b); 6734 } 6735 6736 static __inline__ vector unsigned short __ATTRS_o_ai 6737 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6738 return ~(__a | __b); 6739 } 6740 6741 static __inline__ vector bool short __ATTRS_o_ai 6742 vec_nor(vector bool short __a, vector bool short __b) { 6743 return ~(__a | __b); 6744 } 6745 6746 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6747 vector int __b) { 6748 return ~(__a | __b); 6749 } 6750 6751 static __inline__ vector unsigned int __ATTRS_o_ai 6752 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6753 return ~(__a | __b); 6754 } 6755 6756 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6757 vector bool int __b) { 6758 return ~(__a | __b); 6759 } 6760 6761 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6762 vector float __b) { 6763 vector unsigned int __res = 6764 ~((vector unsigned int)__a | (vector unsigned int)__b); 6765 return (vector float)__res; 6766 } 6767 6768 #ifdef __VSX__ 6769 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6770 vector double __b) { 6771 vector unsigned long long __res = 6772 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6773 return (vector double)__res; 6774 } 6775 #endif 6776 6777 /* vec_vnor */ 6778 6779 static __inline__ vector signed char __ATTRS_o_ai 6780 vec_vnor(vector signed char __a, vector signed char __b) { 6781 return ~(__a | __b); 6782 } 6783 6784 static __inline__ vector unsigned char __ATTRS_o_ai 6785 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6786 return ~(__a | __b); 6787 } 6788 6789 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6790 vector bool char __b) { 6791 return ~(__a | __b); 6792 } 6793 6794 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6795 vector short __b) { 6796 return ~(__a | __b); 6797 } 6798 6799 static __inline__ vector unsigned short __ATTRS_o_ai 6800 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6801 return ~(__a | __b); 6802 } 6803 6804 static __inline__ vector bool short __ATTRS_o_ai 6805 vec_vnor(vector bool short __a, vector bool short __b) { 6806 return ~(__a | __b); 6807 } 6808 6809 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6810 vector int __b) { 6811 return ~(__a | __b); 6812 } 6813 6814 static __inline__ vector unsigned int __ATTRS_o_ai 6815 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6816 return ~(__a | __b); 6817 } 6818 6819 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6820 vector bool int __b) { 6821 return ~(__a | __b); 6822 } 6823 6824 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6825 vector float __b) { 6826 vector unsigned int __res = 6827 ~((vector unsigned int)__a | (vector unsigned int)__b); 6828 return (vector float)__res; 6829 } 6830 6831 #ifdef __VSX__ 6832 static __inline__ vector signed long long __ATTRS_o_ai 6833 vec_nor(vector signed long long __a, vector signed long long __b) { 6834 return ~(__a | __b); 6835 } 6836 6837 static __inline__ vector unsigned long long __ATTRS_o_ai 6838 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6839 return ~(__a | __b); 6840 } 6841 6842 static __inline__ vector bool long long __ATTRS_o_ai 6843 vec_nor(vector bool long long __a, vector bool long long __b) { 6844 return ~(__a | __b); 6845 } 6846 #endif 6847 6848 /* vec_or */ 6849 6850 #define __builtin_altivec_vor vec_or 6851 6852 static __inline__ vector signed char __ATTRS_o_ai 6853 vec_or(vector signed char __a, vector signed char __b) { 6854 return __a | __b; 6855 } 6856 6857 static __inline__ vector signed char __ATTRS_o_ai 6858 vec_or(vector bool char __a, vector signed char __b) { 6859 return (vector signed char)__a | __b; 6860 } 6861 6862 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6863 vector bool char __b) { 6864 return __a | (vector signed char)__b; 6865 } 6866 6867 static __inline__ vector unsigned char __ATTRS_o_ai 6868 vec_or(vector unsigned char __a, vector unsigned char __b) { 6869 return __a | __b; 6870 } 6871 6872 static __inline__ vector unsigned char __ATTRS_o_ai 6873 vec_or(vector bool char __a, vector unsigned char __b) { 6874 return (vector unsigned char)__a | __b; 6875 } 6876 6877 static __inline__ vector unsigned char __ATTRS_o_ai 6878 vec_or(vector unsigned char __a, vector bool char __b) { 6879 return __a | (vector unsigned char)__b; 6880 } 6881 6882 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6883 vector bool char __b) { 6884 return __a | __b; 6885 } 6886 6887 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6888 vector short __b) { 6889 return __a | __b; 6890 } 6891 6892 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6893 vector short __b) { 6894 return (vector short)__a | __b; 6895 } 6896 6897 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6898 vector bool short __b) { 6899 return __a | (vector short)__b; 6900 } 6901 6902 static __inline__ vector unsigned short __ATTRS_o_ai 6903 vec_or(vector unsigned short __a, vector unsigned short __b) { 6904 return __a | __b; 6905 } 6906 6907 static __inline__ vector unsigned short __ATTRS_o_ai 6908 vec_or(vector bool short __a, vector unsigned short __b) { 6909 return (vector unsigned short)__a | __b; 6910 } 6911 6912 static __inline__ vector unsigned short __ATTRS_o_ai 6913 vec_or(vector unsigned short __a, vector bool short __b) { 6914 return __a | (vector unsigned short)__b; 6915 } 6916 6917 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6918 vector bool short __b) { 6919 return __a | __b; 6920 } 6921 6922 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6923 vector int __b) { 6924 return __a | __b; 6925 } 6926 6927 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6928 vector int __b) { 6929 return (vector int)__a | __b; 6930 } 6931 6932 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6933 vector bool int __b) { 6934 return __a | (vector int)__b; 6935 } 6936 6937 static __inline__ vector unsigned int __ATTRS_o_ai 6938 vec_or(vector unsigned int __a, vector unsigned int __b) { 6939 return __a | __b; 6940 } 6941 6942 static __inline__ vector unsigned int __ATTRS_o_ai 6943 vec_or(vector bool int __a, vector unsigned int __b) { 6944 return (vector unsigned int)__a | __b; 6945 } 6946 6947 static __inline__ vector unsigned int __ATTRS_o_ai 6948 vec_or(vector unsigned int __a, vector bool int __b) { 6949 return __a | (vector unsigned int)__b; 6950 } 6951 6952 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6953 vector bool int __b) { 6954 return __a | __b; 6955 } 6956 6957 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6958 vector float __b) { 6959 vector unsigned int __res = 6960 (vector unsigned int)__a | (vector unsigned int)__b; 6961 return (vector float)__res; 6962 } 6963 6964 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6965 vector float __b) { 6966 vector unsigned int __res = 6967 (vector unsigned int)__a | (vector unsigned int)__b; 6968 return (vector float)__res; 6969 } 6970 6971 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6972 vector bool int __b) { 6973 vector unsigned int __res = 6974 (vector unsigned int)__a | (vector unsigned int)__b; 6975 return (vector float)__res; 6976 } 6977 6978 #ifdef __VSX__ 6979 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6980 vector double __b) { 6981 return (vector double)((vector unsigned long long)__a | 6982 (vector unsigned long long)__b); 6983 } 6984 6985 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6986 vector bool long long __b) { 6987 return (vector double)((vector unsigned long long)__a | 6988 (vector unsigned long long)__b); 6989 } 6990 6991 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6992 vector double __b) { 6993 return (vector double)((vector unsigned long long)__a | 6994 (vector unsigned long long)__b); 6995 } 6996 6997 static __inline__ vector signed long long __ATTRS_o_ai 6998 vec_or(vector signed long long __a, vector signed long long __b) { 6999 return __a | __b; 7000 } 7001 7002 static __inline__ vector signed long long __ATTRS_o_ai 7003 vec_or(vector bool long long __a, vector signed long long __b) { 7004 return (vector signed long long)__a | __b; 7005 } 7006 7007 static __inline__ vector signed long long __ATTRS_o_ai 7008 vec_or(vector signed long long __a, vector bool long long __b) { 7009 return __a | (vector signed long long)__b; 7010 } 7011 7012 static __inline__ vector unsigned long long __ATTRS_o_ai 7013 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 7014 return __a | __b; 7015 } 7016 7017 static __inline__ vector unsigned long long __ATTRS_o_ai 7018 vec_or(vector bool long long __a, vector unsigned long long __b) { 7019 return (vector unsigned long long)__a | __b; 7020 } 7021 7022 static __inline__ vector unsigned long long __ATTRS_o_ai 7023 vec_or(vector unsigned long long __a, vector bool long long __b) { 7024 return __a | (vector unsigned long long)__b; 7025 } 7026 7027 static __inline__ vector bool long long __ATTRS_o_ai 7028 vec_or(vector bool long long __a, vector bool long long __b) { 7029 return __a | __b; 7030 } 7031 #endif 7032 7033 #ifdef __POWER8_VECTOR__ 7034 static __inline__ vector signed char __ATTRS_o_ai 7035 vec_orc(vector signed char __a, vector signed char __b) { 7036 return __a | ~__b; 7037 } 7038 7039 static __inline__ vector signed char __ATTRS_o_ai 7040 vec_orc(vector signed char __a, vector bool char __b) { 7041 return __a | (vector signed char)~__b; 7042 } 7043 7044 static __inline__ vector signed char __ATTRS_o_ai 7045 vec_orc(vector bool char __a, vector signed char __b) { 7046 return (vector signed char)(__a | (vector bool char)~__b); 7047 } 7048 7049 static __inline__ vector unsigned char __ATTRS_o_ai 7050 vec_orc(vector unsigned char __a, vector unsigned char __b) { 7051 return __a | ~__b; 7052 } 7053 7054 static __inline__ vector unsigned char __ATTRS_o_ai 7055 vec_orc(vector unsigned char __a, vector bool char __b) { 7056 return __a | (vector unsigned char)~__b; 7057 } 7058 7059 static __inline__ vector unsigned char __ATTRS_o_ai 7060 vec_orc(vector bool char __a, vector unsigned char __b) { 7061 return (vector unsigned char)(__a | (vector bool char)~__b); 7062 } 7063 7064 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 7065 vector bool char __b) { 7066 return __a | ~__b; 7067 } 7068 7069 static __inline__ vector signed short __ATTRS_o_ai 7070 vec_orc(vector signed short __a, vector signed short __b) { 7071 return __a | ~__b; 7072 } 7073 7074 static __inline__ vector signed short __ATTRS_o_ai 7075 vec_orc(vector signed short __a, vector bool short __b) { 7076 return __a | (vector signed short)~__b; 7077 } 7078 7079 static __inline__ vector signed short __ATTRS_o_ai 7080 vec_orc(vector bool short __a, vector signed short __b) { 7081 return (vector signed short)(__a | (vector bool short)~__b); 7082 } 7083 7084 static __inline__ vector unsigned short __ATTRS_o_ai 7085 vec_orc(vector unsigned short __a, vector unsigned short __b) { 7086 return __a | ~__b; 7087 } 7088 7089 static __inline__ vector unsigned short __ATTRS_o_ai 7090 vec_orc(vector unsigned short __a, vector bool short __b) { 7091 return __a | (vector unsigned short)~__b; 7092 } 7093 7094 static __inline__ vector unsigned short __ATTRS_o_ai 7095 vec_orc(vector bool short __a, vector unsigned short __b) { 7096 return (vector unsigned short)(__a | (vector bool short)~__b); 7097 } 7098 7099 static __inline__ vector bool short __ATTRS_o_ai 7100 vec_orc(vector bool short __a, vector bool short __b) { 7101 return __a | ~__b; 7102 } 7103 7104 static __inline__ vector signed int __ATTRS_o_ai 7105 vec_orc(vector signed int __a, vector signed int __b) { 7106 return __a | ~__b; 7107 } 7108 7109 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 7110 vector bool int __b) { 7111 return __a | (vector signed int)~__b; 7112 } 7113 7114 static __inline__ vector signed int __ATTRS_o_ai 7115 vec_orc(vector bool int __a, vector signed int __b) { 7116 return (vector signed int)(__a | (vector bool int)~__b); 7117 } 7118 7119 static __inline__ vector unsigned int __ATTRS_o_ai 7120 vec_orc(vector unsigned int __a, vector unsigned int __b) { 7121 return __a | ~__b; 7122 } 7123 7124 static __inline__ vector unsigned int __ATTRS_o_ai 7125 vec_orc(vector unsigned int __a, vector bool int __b) { 7126 return __a | (vector unsigned int)~__b; 7127 } 7128 7129 static __inline__ vector unsigned int __ATTRS_o_ai 7130 vec_orc(vector bool int __a, vector unsigned int __b) { 7131 return (vector unsigned int)(__a | (vector bool int)~__b); 7132 } 7133 7134 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 7135 vector bool int __b) { 7136 return __a | ~__b; 7137 } 7138 7139 static __inline__ vector float __ATTRS_o_ai 7140 vec_orc(vector bool int __a, vector float __b) { 7141 return (vector float)(__a | ~(vector bool int)__b); 7142 } 7143 7144 static __inline__ vector float __ATTRS_o_ai 7145 vec_orc(vector float __a, vector bool int __b) { 7146 return (vector float)((vector bool int)__a | ~__b); 7147 } 7148 7149 static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a, 7150 vector float __b) { 7151 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b); 7152 } 7153 7154 static __inline__ vector signed long long __ATTRS_o_ai 7155 vec_orc(vector signed long long __a, vector signed long long __b) { 7156 return __a | ~__b; 7157 } 7158 7159 static __inline__ vector signed long long __ATTRS_o_ai 7160 vec_orc(vector signed long long __a, vector bool long long __b) { 7161 return __a | (vector signed long long)~__b; 7162 } 7163 7164 static __inline__ vector signed long long __ATTRS_o_ai 7165 vec_orc(vector bool long long __a, vector signed long long __b) { 7166 return (vector signed long long)(__a | (vector bool long long)~__b); 7167 } 7168 7169 static __inline__ vector unsigned long long __ATTRS_o_ai 7170 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 7171 return __a | ~__b; 7172 } 7173 7174 static __inline__ vector unsigned long long __ATTRS_o_ai 7175 vec_orc(vector unsigned long long __a, vector bool long long __b) { 7176 return __a | (vector unsigned long long)~__b; 7177 } 7178 7179 static __inline__ vector unsigned long long __ATTRS_o_ai 7180 vec_orc(vector bool long long __a, vector unsigned long long __b) { 7181 return (vector unsigned long long)(__a | (vector bool long long)~__b); 7182 } 7183 7184 static __inline__ vector bool long long __ATTRS_o_ai 7185 vec_orc(vector bool long long __a, vector bool long long __b) { 7186 return __a | ~__b; 7187 } 7188 7189 static __inline__ vector double __ATTRS_o_ai 7190 vec_orc(vector double __a, vector bool long long __b) { 7191 return (vector double)((vector bool long long)__a | ~__b); 7192 } 7193 7194 static __inline__ vector double __ATTRS_o_ai 7195 vec_orc(vector bool long long __a, vector double __b) { 7196 return (vector double)(__a | ~(vector bool long long)__b); 7197 } 7198 7199 static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a, 7200 vector double __b) { 7201 return (vector double)((vector unsigned long long)__a | 7202 ~(vector unsigned long long)__b); 7203 } 7204 #endif 7205 7206 /* vec_vor */ 7207 7208 static __inline__ vector signed char __ATTRS_o_ai 7209 vec_vor(vector signed char __a, vector signed char __b) { 7210 return __a | __b; 7211 } 7212 7213 static __inline__ vector signed char __ATTRS_o_ai 7214 vec_vor(vector bool char __a, vector signed char __b) { 7215 return (vector signed char)__a | __b; 7216 } 7217 7218 static __inline__ vector signed char __ATTRS_o_ai 7219 vec_vor(vector signed char __a, vector bool char __b) { 7220 return __a | (vector signed char)__b; 7221 } 7222 7223 static __inline__ vector unsigned char __ATTRS_o_ai 7224 vec_vor(vector unsigned char __a, vector unsigned char __b) { 7225 return __a | __b; 7226 } 7227 7228 static __inline__ vector unsigned char __ATTRS_o_ai 7229 vec_vor(vector bool char __a, vector unsigned char __b) { 7230 return (vector unsigned char)__a | __b; 7231 } 7232 7233 static __inline__ vector unsigned char __ATTRS_o_ai 7234 vec_vor(vector unsigned char __a, vector bool char __b) { 7235 return __a | (vector unsigned char)__b; 7236 } 7237 7238 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 7239 vector bool char __b) { 7240 return __a | __b; 7241 } 7242 7243 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7244 vector short __b) { 7245 return __a | __b; 7246 } 7247 7248 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 7249 vector short __b) { 7250 return (vector short)__a | __b; 7251 } 7252 7253 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7254 vector bool short __b) { 7255 return __a | (vector short)__b; 7256 } 7257 7258 static __inline__ vector unsigned short __ATTRS_o_ai 7259 vec_vor(vector unsigned short __a, vector unsigned short __b) { 7260 return __a | __b; 7261 } 7262 7263 static __inline__ vector unsigned short __ATTRS_o_ai 7264 vec_vor(vector bool short __a, vector unsigned short __b) { 7265 return (vector unsigned short)__a | __b; 7266 } 7267 7268 static __inline__ vector unsigned short __ATTRS_o_ai 7269 vec_vor(vector unsigned short __a, vector bool short __b) { 7270 return __a | (vector unsigned short)__b; 7271 } 7272 7273 static __inline__ vector bool short __ATTRS_o_ai 7274 vec_vor(vector bool short __a, vector bool short __b) { 7275 return __a | __b; 7276 } 7277 7278 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7279 vector int __b) { 7280 return __a | __b; 7281 } 7282 7283 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 7284 vector int __b) { 7285 return (vector int)__a | __b; 7286 } 7287 7288 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7289 vector bool int __b) { 7290 return __a | (vector int)__b; 7291 } 7292 7293 static __inline__ vector unsigned int __ATTRS_o_ai 7294 vec_vor(vector unsigned int __a, vector unsigned int __b) { 7295 return __a | __b; 7296 } 7297 7298 static __inline__ vector unsigned int __ATTRS_o_ai 7299 vec_vor(vector bool int __a, vector unsigned int __b) { 7300 return (vector unsigned int)__a | __b; 7301 } 7302 7303 static __inline__ vector unsigned int __ATTRS_o_ai 7304 vec_vor(vector unsigned int __a, vector bool int __b) { 7305 return __a | (vector unsigned int)__b; 7306 } 7307 7308 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 7309 vector bool int __b) { 7310 return __a | __b; 7311 } 7312 7313 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7314 vector float __b) { 7315 vector unsigned int __res = 7316 (vector unsigned int)__a | (vector unsigned int)__b; 7317 return (vector float)__res; 7318 } 7319 7320 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 7321 vector float __b) { 7322 vector unsigned int __res = 7323 (vector unsigned int)__a | (vector unsigned int)__b; 7324 return (vector float)__res; 7325 } 7326 7327 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7328 vector bool int __b) { 7329 vector unsigned int __res = 7330 (vector unsigned int)__a | (vector unsigned int)__b; 7331 return (vector float)__res; 7332 } 7333 7334 #ifdef __VSX__ 7335 static __inline__ vector signed long long __ATTRS_o_ai 7336 vec_vor(vector signed long long __a, vector signed long long __b) { 7337 return __a | __b; 7338 } 7339 7340 static __inline__ vector signed long long __ATTRS_o_ai 7341 vec_vor(vector bool long long __a, vector signed long long __b) { 7342 return (vector signed long long)__a | __b; 7343 } 7344 7345 static __inline__ vector signed long long __ATTRS_o_ai 7346 vec_vor(vector signed long long __a, vector bool long long __b) { 7347 return __a | (vector signed long long)__b; 7348 } 7349 7350 static __inline__ vector unsigned long long __ATTRS_o_ai 7351 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 7352 return __a | __b; 7353 } 7354 7355 static __inline__ vector unsigned long long __ATTRS_o_ai 7356 vec_vor(vector bool long long __a, vector unsigned long long __b) { 7357 return (vector unsigned long long)__a | __b; 7358 } 7359 7360 static __inline__ vector unsigned long long __ATTRS_o_ai 7361 vec_vor(vector unsigned long long __a, vector bool long long __b) { 7362 return __a | (vector unsigned long long)__b; 7363 } 7364 7365 static __inline__ vector bool long long __ATTRS_o_ai 7366 vec_vor(vector bool long long __a, vector bool long long __b) { 7367 return __a | __b; 7368 } 7369 #endif 7370 7371 /* vec_pack */ 7372 7373 /* The various vector pack instructions have a big-endian bias, so for 7374 little endian we must handle reversed element numbering. */ 7375 7376 static __inline__ vector signed char __ATTRS_o_ai 7377 vec_pack(vector signed short __a, vector signed short __b) { 7378 #ifdef __LITTLE_ENDIAN__ 7379 return (vector signed char)vec_perm( 7380 __a, __b, 7381 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7382 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7383 #else 7384 return (vector signed char)vec_perm( 7385 __a, __b, 7386 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7387 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7388 #endif 7389 } 7390 7391 static __inline__ vector unsigned char __ATTRS_o_ai 7392 vec_pack(vector unsigned short __a, vector unsigned short __b) { 7393 #ifdef __LITTLE_ENDIAN__ 7394 return (vector unsigned char)vec_perm( 7395 __a, __b, 7396 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7397 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7398 #else 7399 return (vector unsigned char)vec_perm( 7400 __a, __b, 7401 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7402 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7403 #endif 7404 } 7405 7406 static __inline__ vector bool char __ATTRS_o_ai 7407 vec_pack(vector bool short __a, vector bool short __b) { 7408 #ifdef __LITTLE_ENDIAN__ 7409 return (vector bool char)vec_perm( 7410 __a, __b, 7411 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7412 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7413 #else 7414 return (vector bool char)vec_perm( 7415 __a, __b, 7416 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7417 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7418 #endif 7419 } 7420 7421 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 7422 vector int __b) { 7423 #ifdef __LITTLE_ENDIAN__ 7424 return (vector short)vec_perm( 7425 __a, __b, 7426 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7427 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7428 #else 7429 return (vector short)vec_perm( 7430 __a, __b, 7431 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7432 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7433 #endif 7434 } 7435 7436 static __inline__ vector unsigned short __ATTRS_o_ai 7437 vec_pack(vector unsigned int __a, vector unsigned int __b) { 7438 #ifdef __LITTLE_ENDIAN__ 7439 return (vector unsigned short)vec_perm( 7440 __a, __b, 7441 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7442 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7443 #else 7444 return (vector unsigned short)vec_perm( 7445 __a, __b, 7446 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7447 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7448 #endif 7449 } 7450 7451 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 7452 vector bool int __b) { 7453 #ifdef __LITTLE_ENDIAN__ 7454 return (vector bool short)vec_perm( 7455 __a, __b, 7456 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7457 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7458 #else 7459 return (vector bool short)vec_perm( 7460 __a, __b, 7461 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7462 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7463 #endif 7464 } 7465 7466 #ifdef __VSX__ 7467 static __inline__ vector signed int __ATTRS_o_ai 7468 vec_pack(vector signed long long __a, vector signed long long __b) { 7469 #ifdef __LITTLE_ENDIAN__ 7470 return (vector signed int)vec_perm( 7471 __a, __b, 7472 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7473 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7474 #else 7475 return (vector signed int)vec_perm( 7476 __a, __b, 7477 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7478 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7479 #endif 7480 } 7481 static __inline__ vector unsigned int __ATTRS_o_ai 7482 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 7483 #ifdef __LITTLE_ENDIAN__ 7484 return (vector unsigned int)vec_perm( 7485 __a, __b, 7486 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7487 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7488 #else 7489 return (vector unsigned int)vec_perm( 7490 __a, __b, 7491 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7492 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7493 #endif 7494 } 7495 7496 static __inline__ vector bool int __ATTRS_o_ai 7497 vec_pack(vector bool long long __a, vector bool long long __b) { 7498 #ifdef __LITTLE_ENDIAN__ 7499 return (vector bool int)vec_perm( 7500 __a, __b, 7501 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7502 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7503 #else 7504 return (vector bool int)vec_perm( 7505 __a, __b, 7506 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7507 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7508 #endif 7509 } 7510 7511 static __inline__ vector float __ATTRS_o_ai 7512 vec_pack(vector double __a, vector double __b) { 7513 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 7514 } 7515 #endif 7516 7517 #ifdef __POWER9_VECTOR__ 7518 static __inline__ vector unsigned short __ATTRS_o_ai 7519 vec_pack_to_short_fp32(vector float __a, vector float __b) { 7520 vector float __resa = __builtin_vsx_xvcvsphp(__a); 7521 vector float __resb = __builtin_vsx_xvcvsphp(__b); 7522 #ifdef __LITTLE_ENDIAN__ 7523 return (vector unsigned short)vec_mergee(__resa, __resb); 7524 #else 7525 return (vector unsigned short)vec_mergeo(__resa, __resb); 7526 #endif 7527 } 7528 7529 #endif 7530 /* vec_vpkuhum */ 7531 7532 #define __builtin_altivec_vpkuhum vec_vpkuhum 7533 7534 static __inline__ vector signed char __ATTRS_o_ai 7535 vec_vpkuhum(vector signed short __a, vector signed short __b) { 7536 #ifdef __LITTLE_ENDIAN__ 7537 return (vector signed char)vec_perm( 7538 __a, __b, 7539 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7540 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7541 #else 7542 return (vector signed char)vec_perm( 7543 __a, __b, 7544 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7545 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7546 #endif 7547 } 7548 7549 static __inline__ vector unsigned char __ATTRS_o_ai 7550 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 7551 #ifdef __LITTLE_ENDIAN__ 7552 return (vector unsigned char)vec_perm( 7553 __a, __b, 7554 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7555 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7556 #else 7557 return (vector unsigned char)vec_perm( 7558 __a, __b, 7559 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7560 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7561 #endif 7562 } 7563 7564 static __inline__ vector bool char __ATTRS_o_ai 7565 vec_vpkuhum(vector bool short __a, vector bool short __b) { 7566 #ifdef __LITTLE_ENDIAN__ 7567 return (vector bool char)vec_perm( 7568 __a, __b, 7569 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7570 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7571 #else 7572 return (vector bool char)vec_perm( 7573 __a, __b, 7574 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7575 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7576 #endif 7577 } 7578 7579 /* vec_vpkuwum */ 7580 7581 #define __builtin_altivec_vpkuwum vec_vpkuwum 7582 7583 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 7584 vector int __b) { 7585 #ifdef __LITTLE_ENDIAN__ 7586 return (vector short)vec_perm( 7587 __a, __b, 7588 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7589 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7590 #else 7591 return (vector short)vec_perm( 7592 __a, __b, 7593 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7594 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7595 #endif 7596 } 7597 7598 static __inline__ vector unsigned short __ATTRS_o_ai 7599 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 7600 #ifdef __LITTLE_ENDIAN__ 7601 return (vector unsigned short)vec_perm( 7602 __a, __b, 7603 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7604 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7605 #else 7606 return (vector unsigned short)vec_perm( 7607 __a, __b, 7608 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7609 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7610 #endif 7611 } 7612 7613 static __inline__ vector bool short __ATTRS_o_ai 7614 vec_vpkuwum(vector bool int __a, vector bool int __b) { 7615 #ifdef __LITTLE_ENDIAN__ 7616 return (vector bool short)vec_perm( 7617 __a, __b, 7618 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7619 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7620 #else 7621 return (vector bool short)vec_perm( 7622 __a, __b, 7623 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7624 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7625 #endif 7626 } 7627 7628 /* vec_vpkudum */ 7629 7630 #ifdef __POWER8_VECTOR__ 7631 #define __builtin_altivec_vpkudum vec_vpkudum 7632 7633 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7634 vector long long __b) { 7635 #ifdef __LITTLE_ENDIAN__ 7636 return (vector int)vec_perm( 7637 __a, __b, 7638 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7639 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7640 #else 7641 return (vector int)vec_perm( 7642 __a, __b, 7643 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7644 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7645 #endif 7646 } 7647 7648 static __inline__ vector unsigned int __ATTRS_o_ai 7649 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7650 #ifdef __LITTLE_ENDIAN__ 7651 return (vector unsigned int)vec_perm( 7652 __a, __b, 7653 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7654 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7655 #else 7656 return (vector unsigned int)vec_perm( 7657 __a, __b, 7658 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7659 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7660 #endif 7661 } 7662 7663 static __inline__ vector bool int __ATTRS_o_ai 7664 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7665 #ifdef __LITTLE_ENDIAN__ 7666 return (vector bool int)vec_perm( 7667 (vector long long)__a, (vector long long)__b, 7668 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7669 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7670 #else 7671 return (vector bool int)vec_perm( 7672 (vector long long)__a, (vector long long)__b, 7673 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7674 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7675 #endif 7676 } 7677 #endif 7678 7679 /* vec_packpx */ 7680 7681 static __inline__ vector pixel __attribute__((__always_inline__)) 7682 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7683 #ifdef __LITTLE_ENDIAN__ 7684 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7685 #else 7686 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7687 #endif 7688 } 7689 7690 /* vec_vpkpx */ 7691 7692 static __inline__ vector pixel __attribute__((__always_inline__)) 7693 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7694 #ifdef __LITTLE_ENDIAN__ 7695 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7696 #else 7697 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7698 #endif 7699 } 7700 7701 /* vec_packs */ 7702 7703 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7704 vector short __b) { 7705 #ifdef __LITTLE_ENDIAN__ 7706 return __builtin_altivec_vpkshss(__b, __a); 7707 #else 7708 return __builtin_altivec_vpkshss(__a, __b); 7709 #endif 7710 } 7711 7712 static __inline__ vector unsigned char __ATTRS_o_ai 7713 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7714 #ifdef __LITTLE_ENDIAN__ 7715 return __builtin_altivec_vpkuhus(__b, __a); 7716 #else 7717 return __builtin_altivec_vpkuhus(__a, __b); 7718 #endif 7719 } 7720 7721 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7722 vector int __b) { 7723 #ifdef __LITTLE_ENDIAN__ 7724 return __builtin_altivec_vpkswss(__b, __a); 7725 #else 7726 return __builtin_altivec_vpkswss(__a, __b); 7727 #endif 7728 } 7729 7730 static __inline__ vector unsigned short __ATTRS_o_ai 7731 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7732 #ifdef __LITTLE_ENDIAN__ 7733 return __builtin_altivec_vpkuwus(__b, __a); 7734 #else 7735 return __builtin_altivec_vpkuwus(__a, __b); 7736 #endif 7737 } 7738 7739 #ifdef __POWER8_VECTOR__ 7740 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7741 vector long long __b) { 7742 #ifdef __LITTLE_ENDIAN__ 7743 return __builtin_altivec_vpksdss(__b, __a); 7744 #else 7745 return __builtin_altivec_vpksdss(__a, __b); 7746 #endif 7747 } 7748 7749 static __inline__ vector unsigned int __ATTRS_o_ai 7750 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7751 #ifdef __LITTLE_ENDIAN__ 7752 return __builtin_altivec_vpkudus(__b, __a); 7753 #else 7754 return __builtin_altivec_vpkudus(__a, __b); 7755 #endif 7756 } 7757 #endif 7758 7759 /* vec_vpkshss */ 7760 7761 static __inline__ vector signed char __attribute__((__always_inline__)) 7762 vec_vpkshss(vector short __a, vector short __b) { 7763 #ifdef __LITTLE_ENDIAN__ 7764 return __builtin_altivec_vpkshss(__b, __a); 7765 #else 7766 return __builtin_altivec_vpkshss(__a, __b); 7767 #endif 7768 } 7769 7770 /* vec_vpksdss */ 7771 7772 #ifdef __POWER8_VECTOR__ 7773 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7774 vector long long __b) { 7775 #ifdef __LITTLE_ENDIAN__ 7776 return __builtin_altivec_vpksdss(__b, __a); 7777 #else 7778 return __builtin_altivec_vpksdss(__a, __b); 7779 #endif 7780 } 7781 #endif 7782 7783 /* vec_vpkuhus */ 7784 7785 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7786 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7787 #ifdef __LITTLE_ENDIAN__ 7788 return __builtin_altivec_vpkuhus(__b, __a); 7789 #else 7790 return __builtin_altivec_vpkuhus(__a, __b); 7791 #endif 7792 } 7793 7794 /* vec_vpkudus */ 7795 7796 #ifdef __POWER8_VECTOR__ 7797 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7798 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7799 #ifdef __LITTLE_ENDIAN__ 7800 return __builtin_altivec_vpkudus(__b, __a); 7801 #else 7802 return __builtin_altivec_vpkudus(__a, __b); 7803 #endif 7804 } 7805 #endif 7806 7807 /* vec_vpkswss */ 7808 7809 static __inline__ vector signed short __attribute__((__always_inline__)) 7810 vec_vpkswss(vector int __a, vector int __b) { 7811 #ifdef __LITTLE_ENDIAN__ 7812 return __builtin_altivec_vpkswss(__b, __a); 7813 #else 7814 return __builtin_altivec_vpkswss(__a, __b); 7815 #endif 7816 } 7817 7818 /* vec_vpkuwus */ 7819 7820 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7821 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7822 #ifdef __LITTLE_ENDIAN__ 7823 return __builtin_altivec_vpkuwus(__b, __a); 7824 #else 7825 return __builtin_altivec_vpkuwus(__a, __b); 7826 #endif 7827 } 7828 7829 /* vec_packsu */ 7830 7831 static __inline__ vector unsigned char __ATTRS_o_ai 7832 vec_packsu(vector short __a, vector short __b) { 7833 #ifdef __LITTLE_ENDIAN__ 7834 return __builtin_altivec_vpkshus(__b, __a); 7835 #else 7836 return __builtin_altivec_vpkshus(__a, __b); 7837 #endif 7838 } 7839 7840 static __inline__ vector unsigned char __ATTRS_o_ai 7841 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7842 #ifdef __LITTLE_ENDIAN__ 7843 return __builtin_altivec_vpkuhus(__b, __a); 7844 #else 7845 return __builtin_altivec_vpkuhus(__a, __b); 7846 #endif 7847 } 7848 7849 static __inline__ vector unsigned short __ATTRS_o_ai 7850 vec_packsu(vector int __a, vector int __b) { 7851 #ifdef __LITTLE_ENDIAN__ 7852 return __builtin_altivec_vpkswus(__b, __a); 7853 #else 7854 return __builtin_altivec_vpkswus(__a, __b); 7855 #endif 7856 } 7857 7858 static __inline__ vector unsigned short __ATTRS_o_ai 7859 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7860 #ifdef __LITTLE_ENDIAN__ 7861 return __builtin_altivec_vpkuwus(__b, __a); 7862 #else 7863 return __builtin_altivec_vpkuwus(__a, __b); 7864 #endif 7865 } 7866 7867 #ifdef __POWER8_VECTOR__ 7868 static __inline__ vector unsigned int __ATTRS_o_ai 7869 vec_packsu(vector long long __a, vector long long __b) { 7870 #ifdef __LITTLE_ENDIAN__ 7871 return __builtin_altivec_vpksdus(__b, __a); 7872 #else 7873 return __builtin_altivec_vpksdus(__a, __b); 7874 #endif 7875 } 7876 7877 static __inline__ vector unsigned int __ATTRS_o_ai 7878 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7879 #ifdef __LITTLE_ENDIAN__ 7880 return __builtin_altivec_vpkudus(__b, __a); 7881 #else 7882 return __builtin_altivec_vpkudus(__a, __b); 7883 #endif 7884 } 7885 #endif 7886 7887 /* vec_vpkshus */ 7888 7889 static __inline__ vector unsigned char __ATTRS_o_ai 7890 vec_vpkshus(vector short __a, vector short __b) { 7891 #ifdef __LITTLE_ENDIAN__ 7892 return __builtin_altivec_vpkshus(__b, __a); 7893 #else 7894 return __builtin_altivec_vpkshus(__a, __b); 7895 #endif 7896 } 7897 7898 static __inline__ vector unsigned char __ATTRS_o_ai 7899 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7900 #ifdef __LITTLE_ENDIAN__ 7901 return __builtin_altivec_vpkuhus(__b, __a); 7902 #else 7903 return __builtin_altivec_vpkuhus(__a, __b); 7904 #endif 7905 } 7906 7907 /* vec_vpkswus */ 7908 7909 static __inline__ vector unsigned short __ATTRS_o_ai 7910 vec_vpkswus(vector int __a, vector int __b) { 7911 #ifdef __LITTLE_ENDIAN__ 7912 return __builtin_altivec_vpkswus(__b, __a); 7913 #else 7914 return __builtin_altivec_vpkswus(__a, __b); 7915 #endif 7916 } 7917 7918 static __inline__ vector unsigned short __ATTRS_o_ai 7919 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7920 #ifdef __LITTLE_ENDIAN__ 7921 return __builtin_altivec_vpkuwus(__b, __a); 7922 #else 7923 return __builtin_altivec_vpkuwus(__a, __b); 7924 #endif 7925 } 7926 7927 /* vec_vpksdus */ 7928 7929 #ifdef __POWER8_VECTOR__ 7930 static __inline__ vector unsigned int __ATTRS_o_ai 7931 vec_vpksdus(vector long long __a, vector long long __b) { 7932 #ifdef __LITTLE_ENDIAN__ 7933 return __builtin_altivec_vpksdus(__b, __a); 7934 #else 7935 return __builtin_altivec_vpksdus(__a, __b); 7936 #endif 7937 } 7938 #endif 7939 7940 /* vec_perm */ 7941 7942 // The vperm instruction is defined architecturally with a big-endian bias. 7943 // For little endian, we swap the input operands and invert the permute 7944 // control vector. Only the rightmost 5 bits matter, so we could use 7945 // a vector of all 31s instead of all 255s to perform the inversion. 7946 // However, when the PCV is not a constant, using 255 has an advantage 7947 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7948 // later, possibly a vec_nand). 7949 7950 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7951 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7952 #ifdef __LITTLE_ENDIAN__ 7953 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7954 255, 255, 255, 255, 255, 255, 255, 255}; 7955 __d = vec_xor(__c, __d); 7956 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7957 (vector int)__a, __d); 7958 #else 7959 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7960 (vector int)__b, __c); 7961 #endif 7962 } 7963 7964 static __inline__ vector unsigned char __ATTRS_o_ai 7965 vec_perm(vector unsigned char __a, vector unsigned char __b, 7966 vector unsigned char __c) { 7967 #ifdef __LITTLE_ENDIAN__ 7968 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7969 255, 255, 255, 255, 255, 255, 255, 255}; 7970 __d = vec_xor(__c, __d); 7971 return (vector unsigned char)__builtin_altivec_vperm_4si( 7972 (vector int)__b, (vector int)__a, __d); 7973 #else 7974 return (vector unsigned char)__builtin_altivec_vperm_4si( 7975 (vector int)__a, (vector int)__b, __c); 7976 #endif 7977 } 7978 7979 static __inline__ vector bool char __ATTRS_o_ai 7980 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7981 #ifdef __LITTLE_ENDIAN__ 7982 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7983 255, 255, 255, 255, 255, 255, 255, 255}; 7984 __d = vec_xor(__c, __d); 7985 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 7986 (vector int)__a, __d); 7987 #else 7988 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7989 (vector int)__b, __c); 7990 #endif 7991 } 7992 7993 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7994 vector signed short __b, 7995 vector unsigned char __c) { 7996 #ifdef __LITTLE_ENDIAN__ 7997 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7998 255, 255, 255, 255, 255, 255, 255, 255}; 7999 __d = vec_xor(__c, __d); 8000 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 8001 (vector int)__a, __d); 8002 #else 8003 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 8004 (vector int)__b, __c); 8005 #endif 8006 } 8007 8008 static __inline__ vector unsigned short __ATTRS_o_ai 8009 vec_perm(vector unsigned short __a, vector unsigned short __b, 8010 vector unsigned char __c) { 8011 #ifdef __LITTLE_ENDIAN__ 8012 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8013 255, 255, 255, 255, 255, 255, 255, 255}; 8014 __d = vec_xor(__c, __d); 8015 return (vector unsigned short)__builtin_altivec_vperm_4si( 8016 (vector int)__b, (vector int)__a, __d); 8017 #else 8018 return (vector unsigned short)__builtin_altivec_vperm_4si( 8019 (vector int)__a, (vector int)__b, __c); 8020 #endif 8021 } 8022 8023 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 8024 vector bool short __a, vector bool short __b, vector unsigned char __c) { 8025 #ifdef __LITTLE_ENDIAN__ 8026 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8027 255, 255, 255, 255, 255, 255, 255, 255}; 8028 __d = vec_xor(__c, __d); 8029 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 8030 (vector int)__a, __d); 8031 #else 8032 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 8033 (vector int)__b, __c); 8034 #endif 8035 } 8036 8037 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 8038 vector pixel __b, 8039 vector unsigned char __c) { 8040 #ifdef __LITTLE_ENDIAN__ 8041 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8042 255, 255, 255, 255, 255, 255, 255, 255}; 8043 __d = vec_xor(__c, __d); 8044 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 8045 (vector int)__a, __d); 8046 #else 8047 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 8048 (vector int)__b, __c); 8049 #endif 8050 } 8051 8052 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 8053 vector signed int __b, 8054 vector unsigned char __c) { 8055 #ifdef __LITTLE_ENDIAN__ 8056 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8057 255, 255, 255, 255, 255, 255, 255, 255}; 8058 __d = vec_xor(__c, __d); 8059 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 8060 #else 8061 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 8062 #endif 8063 } 8064 8065 static __inline__ vector unsigned int __ATTRS_o_ai 8066 vec_perm(vector unsigned int __a, vector unsigned int __b, 8067 vector unsigned char __c) { 8068 #ifdef __LITTLE_ENDIAN__ 8069 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8070 255, 255, 255, 255, 255, 255, 255, 255}; 8071 __d = vec_xor(__c, __d); 8072 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 8073 (vector int)__a, __d); 8074 #else 8075 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 8076 (vector int)__b, __c); 8077 #endif 8078 } 8079 8080 static __inline__ vector bool int __ATTRS_o_ai 8081 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8082 #ifdef __LITTLE_ENDIAN__ 8083 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8084 255, 255, 255, 255, 255, 255, 255, 255}; 8085 __d = vec_xor(__c, __d); 8086 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 8087 (vector int)__a, __d); 8088 #else 8089 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 8090 (vector int)__b, __c); 8091 #endif 8092 } 8093 8094 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 8095 vector float __b, 8096 vector unsigned char __c) { 8097 #ifdef __LITTLE_ENDIAN__ 8098 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8099 255, 255, 255, 255, 255, 255, 255, 255}; 8100 __d = vec_xor(__c, __d); 8101 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 8102 (vector int)__a, __d); 8103 #else 8104 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 8105 (vector int)__b, __c); 8106 #endif 8107 } 8108 8109 #ifdef __VSX__ 8110 static __inline__ vector long long __ATTRS_o_ai 8111 vec_perm(vector signed long long __a, vector signed long long __b, 8112 vector unsigned char __c) { 8113 #ifdef __LITTLE_ENDIAN__ 8114 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8115 255, 255, 255, 255, 255, 255, 255, 255}; 8116 __d = vec_xor(__c, __d); 8117 return (vector signed long long)__builtin_altivec_vperm_4si( 8118 (vector int)__b, (vector int)__a, __d); 8119 #else 8120 return (vector signed long long)__builtin_altivec_vperm_4si( 8121 (vector int)__a, (vector int)__b, __c); 8122 #endif 8123 } 8124 8125 static __inline__ vector unsigned long long __ATTRS_o_ai 8126 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 8127 vector unsigned char __c) { 8128 #ifdef __LITTLE_ENDIAN__ 8129 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8130 255, 255, 255, 255, 255, 255, 255, 255}; 8131 __d = vec_xor(__c, __d); 8132 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8133 (vector int)__b, (vector int)__a, __d); 8134 #else 8135 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8136 (vector int)__a, (vector int)__b, __c); 8137 #endif 8138 } 8139 8140 static __inline__ vector bool long long __ATTRS_o_ai 8141 vec_perm(vector bool long long __a, vector bool long long __b, 8142 vector unsigned char __c) { 8143 #ifdef __LITTLE_ENDIAN__ 8144 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8145 255, 255, 255, 255, 255, 255, 255, 255}; 8146 __d = vec_xor(__c, __d); 8147 return (vector bool long long)__builtin_altivec_vperm_4si( 8148 (vector int)__b, (vector int)__a, __d); 8149 #else 8150 return (vector bool long long)__builtin_altivec_vperm_4si( 8151 (vector int)__a, (vector int)__b, __c); 8152 #endif 8153 } 8154 8155 static __inline__ vector double __ATTRS_o_ai 8156 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 8157 #ifdef __LITTLE_ENDIAN__ 8158 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8159 255, 255, 255, 255, 255, 255, 255, 255}; 8160 __d = vec_xor(__c, __d); 8161 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 8162 (vector int)__a, __d); 8163 #else 8164 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 8165 (vector int)__b, __c); 8166 #endif 8167 } 8168 #endif 8169 8170 /* vec_vperm */ 8171 8172 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 8173 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8174 return vec_perm(__a, __b, __c); 8175 } 8176 8177 static __inline__ vector unsigned char __ATTRS_o_ai 8178 vec_vperm(vector unsigned char __a, vector unsigned char __b, 8179 vector unsigned char __c) { 8180 return vec_perm(__a, __b, __c); 8181 } 8182 8183 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 8184 vector bool char __a, vector bool char __b, vector unsigned char __c) { 8185 return vec_perm(__a, __b, __c); 8186 } 8187 8188 static __inline__ vector short __ATTRS_o_ai 8189 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 8190 return vec_perm(__a, __b, __c); 8191 } 8192 8193 static __inline__ vector unsigned short __ATTRS_o_ai 8194 vec_vperm(vector unsigned short __a, vector unsigned short __b, 8195 vector unsigned char __c) { 8196 return vec_perm(__a, __b, __c); 8197 } 8198 8199 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 8200 vector bool short __a, vector bool short __b, vector unsigned char __c) { 8201 return vec_perm(__a, __b, __c); 8202 } 8203 8204 static __inline__ vector pixel __ATTRS_o_ai 8205 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 8206 return vec_perm(__a, __b, __c); 8207 } 8208 8209 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 8210 vector int __b, 8211 vector unsigned char __c) { 8212 return vec_perm(__a, __b, __c); 8213 } 8214 8215 static __inline__ vector unsigned int __ATTRS_o_ai 8216 vec_vperm(vector unsigned int __a, vector unsigned int __b, 8217 vector unsigned char __c) { 8218 return vec_perm(__a, __b, __c); 8219 } 8220 8221 static __inline__ vector bool int __ATTRS_o_ai 8222 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8223 return vec_perm(__a, __b, __c); 8224 } 8225 8226 static __inline__ vector float __ATTRS_o_ai 8227 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 8228 return vec_perm(__a, __b, __c); 8229 } 8230 8231 #ifdef __VSX__ 8232 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 8233 vector long long __a, vector long long __b, vector unsigned char __c) { 8234 return vec_perm(__a, __b, __c); 8235 } 8236 8237 static __inline__ vector unsigned long long __ATTRS_o_ai 8238 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 8239 vector unsigned char __c) { 8240 return vec_perm(__a, __b, __c); 8241 } 8242 8243 static __inline__ vector double __ATTRS_o_ai 8244 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 8245 return vec_perm(__a, __b, __c); 8246 } 8247 #endif 8248 8249 /* vec_re */ 8250 8251 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 8252 #ifdef __VSX__ 8253 return __builtin_vsx_xvresp(__a); 8254 #else 8255 return __builtin_altivec_vrefp(__a); 8256 #endif 8257 } 8258 8259 #ifdef __VSX__ 8260 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 8261 return __builtin_vsx_xvredp(__a); 8262 } 8263 #endif 8264 8265 /* vec_vrefp */ 8266 8267 static __inline__ vector float __attribute__((__always_inline__)) 8268 vec_vrefp(vector float __a) { 8269 return __builtin_altivec_vrefp(__a); 8270 } 8271 8272 /* vec_rl */ 8273 8274 static __inline__ vector signed char __ATTRS_o_ai 8275 vec_rl(vector signed char __a, vector unsigned char __b) { 8276 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8277 } 8278 8279 static __inline__ vector unsigned char __ATTRS_o_ai 8280 vec_rl(vector unsigned char __a, vector unsigned char __b) { 8281 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8282 } 8283 8284 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 8285 vector unsigned short __b) { 8286 return __builtin_altivec_vrlh(__a, __b); 8287 } 8288 8289 static __inline__ vector unsigned short __ATTRS_o_ai 8290 vec_rl(vector unsigned short __a, vector unsigned short __b) { 8291 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8292 } 8293 8294 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 8295 vector unsigned int __b) { 8296 return __builtin_altivec_vrlw(__a, __b); 8297 } 8298 8299 static __inline__ vector unsigned int __ATTRS_o_ai 8300 vec_rl(vector unsigned int __a, vector unsigned int __b) { 8301 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8302 } 8303 8304 #ifdef __POWER8_VECTOR__ 8305 static __inline__ vector signed long long __ATTRS_o_ai 8306 vec_rl(vector signed long long __a, vector unsigned long long __b) { 8307 return __builtin_altivec_vrld(__a, __b); 8308 } 8309 8310 static __inline__ vector unsigned long long __ATTRS_o_ai 8311 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 8312 return (vector unsigned long long)__builtin_altivec_vrld( 8313 (vector long long)__a, __b); 8314 } 8315 #endif 8316 8317 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8318 static __inline__ vector signed __int128 __ATTRS_o_ai 8319 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { 8320 return (vector signed __int128)(((vector unsigned __int128)__b 8321 << (vector unsigned __int128)__a) | 8322 ((vector unsigned __int128)__b >> 8323 ((__CHAR_BIT__ * 8324 sizeof(vector unsigned __int128)) - 8325 (vector unsigned __int128)__a))); 8326 } 8327 8328 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8329 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 8330 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); 8331 } 8332 #endif 8333 8334 /* vec_rlmi */ 8335 #ifdef __POWER9_VECTOR__ 8336 static __inline__ vector unsigned int __ATTRS_o_ai 8337 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 8338 vector unsigned int __c) { 8339 return __builtin_altivec_vrlwmi(__a, __c, __b); 8340 } 8341 8342 static __inline__ vector unsigned long long __ATTRS_o_ai 8343 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 8344 vector unsigned long long __c) { 8345 return __builtin_altivec_vrldmi(__a, __c, __b); 8346 } 8347 #endif 8348 8349 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8350 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8351 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, 8352 vector unsigned __int128 __c) { 8353 return __builtin_altivec_vrlqmi(__a, __c, __b); 8354 } 8355 8356 static __inline__ vector signed __int128 __ATTRS_o_ai 8357 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, 8358 vector signed __int128 __c) { 8359 return (vector signed __int128)__builtin_altivec_vrlqmi( 8360 (vector unsigned __int128)__a, (vector unsigned __int128)__c, 8361 (vector unsigned __int128)__b); 8362 } 8363 #endif 8364 8365 /* vec_rlnm */ 8366 #ifdef __POWER9_VECTOR__ 8367 static __inline__ vector unsigned int __ATTRS_o_ai 8368 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 8369 vector unsigned int __c) { 8370 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 8371 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 8372 } 8373 8374 static __inline__ vector unsigned long long __ATTRS_o_ai 8375 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 8376 vector unsigned long long __c) { 8377 vector unsigned long long OneByte = { 0x8, 0x8 }; 8378 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 8379 } 8380 #endif 8381 8382 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8383 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8384 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, 8385 vector unsigned __int128 __c) { 8386 // Merge __b and __c using an appropriate shuffle. 8387 vector unsigned char TmpB = (vector unsigned char)__b; 8388 vector unsigned char TmpC = (vector unsigned char)__c; 8389 vector unsigned char MaskAndShift = 8390 #ifdef __LITTLE_ENDIAN__ 8391 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8392 1, -1, -1, -1, -1, -1); 8393 #else 8394 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8395 -1, -1, -1, -1, -1, -1, -1); 8396 #endif 8397 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8398 } 8399 8400 static __inline__ vector signed __int128 __ATTRS_o_ai 8401 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, 8402 vector signed __int128 __c) { 8403 // Merge __b and __c using an appropriate shuffle. 8404 vector unsigned char TmpB = (vector unsigned char)__b; 8405 vector unsigned char TmpC = (vector unsigned char)__c; 8406 vector unsigned char MaskAndShift = 8407 #ifdef __LITTLE_ENDIAN__ 8408 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8409 1, -1, -1, -1, -1, -1); 8410 #else 8411 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8412 -1, -1, -1, -1, -1, -1, -1); 8413 #endif 8414 return (vector signed __int128)__builtin_altivec_vrlqnm( 8415 (vector unsigned __int128)__a, (vector unsigned __int128)MaskAndShift); 8416 } 8417 #endif 8418 8419 /* vec_vrlb */ 8420 8421 static __inline__ vector signed char __ATTRS_o_ai 8422 vec_vrlb(vector signed char __a, vector unsigned char __b) { 8423 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8424 } 8425 8426 static __inline__ vector unsigned char __ATTRS_o_ai 8427 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 8428 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8429 } 8430 8431 /* vec_vrlh */ 8432 8433 static __inline__ vector short __ATTRS_o_ai 8434 vec_vrlh(vector short __a, vector unsigned short __b) { 8435 return __builtin_altivec_vrlh(__a, __b); 8436 } 8437 8438 static __inline__ vector unsigned short __ATTRS_o_ai 8439 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 8440 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8441 } 8442 8443 /* vec_vrlw */ 8444 8445 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 8446 vector unsigned int __b) { 8447 return __builtin_altivec_vrlw(__a, __b); 8448 } 8449 8450 static __inline__ vector unsigned int __ATTRS_o_ai 8451 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 8452 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8453 } 8454 8455 /* vec_round */ 8456 8457 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 8458 return __builtin_altivec_vrfin(__a); 8459 } 8460 8461 #ifdef __VSX__ 8462 #ifdef __XL_COMPAT_ALTIVEC__ 8463 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a); 8464 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8465 double __fpscr = __builtin_readflm(); 8466 __builtin_setrnd(0); 8467 vector double __rounded = vec_rint(__a); 8468 __builtin_setflm(__fpscr); 8469 return __rounded; 8470 } 8471 #else 8472 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8473 return __builtin_vsx_xvrdpi(__a); 8474 } 8475 #endif 8476 8477 /* vec_rint */ 8478 8479 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 8480 return __builtin_vsx_xvrspic(__a); 8481 } 8482 8483 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 8484 return __builtin_vsx_xvrdpic(__a); 8485 } 8486 8487 /* vec_roundc */ 8488 8489 static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { 8490 return __builtin_vsx_xvrspic(__a); 8491 } 8492 8493 static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { 8494 return __builtin_vsx_xvrdpic(__a); 8495 } 8496 8497 /* vec_nearbyint */ 8498 8499 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 8500 return __builtin_vsx_xvrspi(__a); 8501 } 8502 8503 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 8504 return __builtin_vsx_xvrdpi(__a); 8505 } 8506 #endif 8507 8508 /* vec_vrfin */ 8509 8510 static __inline__ vector float __attribute__((__always_inline__)) 8511 vec_vrfin(vector float __a) { 8512 return __builtin_altivec_vrfin(__a); 8513 } 8514 8515 /* vec_sqrt */ 8516 8517 #ifdef __VSX__ 8518 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 8519 return __builtin_vsx_xvsqrtsp(__a); 8520 } 8521 8522 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 8523 return __builtin_vsx_xvsqrtdp(__a); 8524 } 8525 #endif 8526 8527 /* vec_rsqrte */ 8528 8529 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 8530 #ifdef __VSX__ 8531 return __builtin_vsx_xvrsqrtesp(__a); 8532 #else 8533 return __builtin_altivec_vrsqrtefp(__a); 8534 #endif 8535 } 8536 8537 #ifdef __VSX__ 8538 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 8539 return __builtin_vsx_xvrsqrtedp(__a); 8540 } 8541 #endif 8542 8543 static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { 8544 return __builtin_ppc_rsqrtf(__a); 8545 } 8546 8547 #ifdef __VSX__ 8548 static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { 8549 return __builtin_ppc_rsqrtd(__a); 8550 } 8551 #endif 8552 8553 /* vec_vrsqrtefp */ 8554 8555 static __inline__ __vector float __attribute__((__always_inline__)) 8556 vec_vrsqrtefp(vector float __a) { 8557 return __builtin_altivec_vrsqrtefp(__a); 8558 } 8559 8560 /* vec_xvtsqrt */ 8561 8562 #ifdef __VSX__ 8563 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { 8564 return __builtin_vsx_xvtsqrtdp(__a); 8565 } 8566 8567 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { 8568 return __builtin_vsx_xvtsqrtsp(__a); 8569 } 8570 #endif 8571 8572 /* vec_sel */ 8573 8574 #define __builtin_altivec_vsel_4si vec_sel 8575 8576 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 8577 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8578 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8579 } 8580 8581 static __inline__ vector signed char __ATTRS_o_ai 8582 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 8583 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8584 } 8585 8586 static __inline__ vector unsigned char __ATTRS_o_ai 8587 vec_sel(vector unsigned char __a, vector unsigned char __b, 8588 vector unsigned char __c) { 8589 return (__a & ~__c) | (__b & __c); 8590 } 8591 8592 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 8593 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8594 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8595 } 8596 8597 static __inline__ vector bool char __ATTRS_o_ai 8598 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8599 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8600 } 8601 8602 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 8603 vector bool char __b, 8604 vector bool char __c) { 8605 return (__a & ~__c) | (__b & __c); 8606 } 8607 8608 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8609 vector short __b, 8610 vector unsigned short __c) { 8611 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8612 } 8613 8614 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8615 vector short __b, 8616 vector bool short __c) { 8617 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8618 } 8619 8620 static __inline__ vector unsigned short __ATTRS_o_ai 8621 vec_sel(vector unsigned short __a, vector unsigned short __b, 8622 vector unsigned short __c) { 8623 return (__a & ~__c) | (__b & __c); 8624 } 8625 8626 static __inline__ vector unsigned short __ATTRS_o_ai 8627 vec_sel(vector unsigned short __a, vector unsigned short __b, 8628 vector bool short __c) { 8629 return (__a & ~(vector unsigned short)__c) | 8630 (__b & (vector unsigned short)__c); 8631 } 8632 8633 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 8634 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8635 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8636 } 8637 8638 static __inline__ vector bool short __ATTRS_o_ai 8639 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 8640 return (__a & ~__c) | (__b & __c); 8641 } 8642 8643 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8644 vector int __b, 8645 vector unsigned int __c) { 8646 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8647 } 8648 8649 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8650 vector int __b, 8651 vector bool int __c) { 8652 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8653 } 8654 8655 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 8656 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8657 return (__a & ~__c) | (__b & __c); 8658 } 8659 8660 static __inline__ vector unsigned int __ATTRS_o_ai 8661 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8662 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8663 } 8664 8665 static __inline__ vector bool int __ATTRS_o_ai 8666 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8667 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8668 } 8669 8670 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 8671 vector bool int __b, 8672 vector bool int __c) { 8673 return (__a & ~__c) | (__b & __c); 8674 } 8675 8676 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8677 vector float __b, 8678 vector unsigned int __c) { 8679 vector int __res = ((vector int)__a & ~(vector int)__c) | 8680 ((vector int)__b & (vector int)__c); 8681 return (vector float)__res; 8682 } 8683 8684 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8685 vector float __b, 8686 vector bool int __c) { 8687 vector int __res = ((vector int)__a & ~(vector int)__c) | 8688 ((vector int)__b & (vector int)__c); 8689 return (vector float)__res; 8690 } 8691 8692 #ifdef __VSX__ 8693 static __inline__ vector double __ATTRS_o_ai 8694 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 8695 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8696 ((vector long long)__b & (vector long long)__c); 8697 return (vector double)__res; 8698 } 8699 8700 static __inline__ vector double __ATTRS_o_ai 8701 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 8702 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8703 ((vector long long)__b & (vector long long)__c); 8704 return (vector double)__res; 8705 } 8706 8707 static __inline__ vector bool long long __ATTRS_o_ai 8708 vec_sel(vector bool long long __a, vector bool long long __b, 8709 vector bool long long __c) { 8710 return (__a & ~__c) | (__b & __c); 8711 } 8712 8713 static __inline__ vector bool long long __ATTRS_o_ai 8714 vec_sel(vector bool long long __a, vector bool long long __b, 8715 vector unsigned long long __c) { 8716 return (__a & ~(vector bool long long)__c) | 8717 (__b & (vector bool long long)__c); 8718 } 8719 8720 static __inline__ vector signed long long __ATTRS_o_ai 8721 vec_sel(vector signed long long __a, vector signed long long __b, 8722 vector bool long long __c) { 8723 return (__a & ~(vector signed long long)__c) | 8724 (__b & (vector signed long long)__c); 8725 } 8726 8727 static __inline__ vector signed long long __ATTRS_o_ai 8728 vec_sel(vector signed long long __a, vector signed long long __b, 8729 vector unsigned long long __c) { 8730 return (__a & ~(vector signed long long)__c) | 8731 (__b & (vector signed long long)__c); 8732 } 8733 8734 static __inline__ vector unsigned long long __ATTRS_o_ai 8735 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8736 vector bool long long __c) { 8737 return (__a & ~(vector unsigned long long)__c) | 8738 (__b & (vector unsigned long long)__c); 8739 } 8740 8741 static __inline__ vector unsigned long long __ATTRS_o_ai 8742 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8743 vector unsigned long long __c) { 8744 return (__a & ~__c) | (__b & __c); 8745 } 8746 #endif 8747 8748 /* vec_vsel */ 8749 8750 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 8751 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8752 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8753 } 8754 8755 static __inline__ vector signed char __ATTRS_o_ai 8756 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 8757 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8758 } 8759 8760 static __inline__ vector unsigned char __ATTRS_o_ai 8761 vec_vsel(vector unsigned char __a, vector unsigned char __b, 8762 vector unsigned char __c) { 8763 return (__a & ~__c) | (__b & __c); 8764 } 8765 8766 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 8767 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8768 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8769 } 8770 8771 static __inline__ vector bool char __ATTRS_o_ai 8772 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8773 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8774 } 8775 8776 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 8777 vector bool char __b, 8778 vector bool char __c) { 8779 return (__a & ~__c) | (__b & __c); 8780 } 8781 8782 static __inline__ vector short __ATTRS_o_ai 8783 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8784 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8785 } 8786 8787 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8788 vector short __b, 8789 vector bool short __c) { 8790 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8791 } 8792 8793 static __inline__ vector unsigned short __ATTRS_o_ai 8794 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8795 vector unsigned short __c) { 8796 return (__a & ~__c) | (__b & __c); 8797 } 8798 8799 static __inline__ vector unsigned short __ATTRS_o_ai 8800 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8801 vector bool short __c) { 8802 return (__a & ~(vector unsigned short)__c) | 8803 (__b & (vector unsigned short)__c); 8804 } 8805 8806 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8807 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8808 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8809 } 8810 8811 static __inline__ vector bool short __ATTRS_o_ai 8812 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8813 return (__a & ~__c) | (__b & __c); 8814 } 8815 8816 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8817 vector int __b, 8818 vector unsigned int __c) { 8819 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8820 } 8821 8822 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8823 vector int __b, 8824 vector bool int __c) { 8825 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8826 } 8827 8828 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8829 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8830 return (__a & ~__c) | (__b & __c); 8831 } 8832 8833 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8834 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8835 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8836 } 8837 8838 static __inline__ vector bool int __ATTRS_o_ai 8839 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8840 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8841 } 8842 8843 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8844 vector bool int __b, 8845 vector bool int __c) { 8846 return (__a & ~__c) | (__b & __c); 8847 } 8848 8849 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8850 vector float __b, 8851 vector unsigned int __c) { 8852 vector int __res = ((vector int)__a & ~(vector int)__c) | 8853 ((vector int)__b & (vector int)__c); 8854 return (vector float)__res; 8855 } 8856 8857 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8858 vector float __b, 8859 vector bool int __c) { 8860 vector int __res = ((vector int)__a & ~(vector int)__c) | 8861 ((vector int)__b & (vector int)__c); 8862 return (vector float)__res; 8863 } 8864 8865 /* vec_sl */ 8866 8867 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8868 // than the length of __a. 8869 static __inline__ vector unsigned char __ATTRS_o_ai 8870 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8871 return __a << (__b % 8872 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8873 } 8874 8875 static __inline__ vector signed char __ATTRS_o_ai 8876 vec_sl(vector signed char __a, vector unsigned char __b) { 8877 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8878 } 8879 8880 static __inline__ vector unsigned short __ATTRS_o_ai 8881 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8882 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8883 __CHAR_BIT__)); 8884 } 8885 8886 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8887 vector unsigned short __b) { 8888 return (vector short)vec_sl((vector unsigned short)__a, __b); 8889 } 8890 8891 static __inline__ vector unsigned int __ATTRS_o_ai 8892 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8893 return __a << (__b % 8894 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8895 } 8896 8897 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8898 vector unsigned int __b) { 8899 return (vector int)vec_sl((vector unsigned int)__a, __b); 8900 } 8901 8902 #ifdef __POWER8_VECTOR__ 8903 static __inline__ vector unsigned long long __ATTRS_o_ai 8904 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8905 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8906 __CHAR_BIT__)); 8907 } 8908 8909 static __inline__ vector long long __ATTRS_o_ai 8910 vec_sl(vector long long __a, vector unsigned long long __b) { 8911 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8912 } 8913 #elif defined(__VSX__) 8914 static __inline__ vector unsigned char __ATTRS_o_ai 8915 vec_vspltb(vector unsigned char __a, unsigned char __b); 8916 static __inline__ vector unsigned long long __ATTRS_o_ai 8917 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8918 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 8919 8920 // Big endian element one (the right doubleword) can be left shifted as-is. 8921 // The other element needs to be swapped into the right doubleword and 8922 // shifted. Then the right doublewords of the two result vectors are merged. 8923 vector signed long long __rightelt = 8924 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8925 (vector signed int)__b); 8926 #ifdef __LITTLE_ENDIAN__ 8927 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8928 (vector signed int)__rightelt, 8929 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8930 #else 8931 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8932 (vector signed int)__rightelt, 8933 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8934 #endif 8935 __a = __builtin_shufflevector(__a, __a, 1, 0); 8936 __b = __builtin_shufflevector(__b, __b, 1, 0); 8937 vector signed long long __leftelt = 8938 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8939 (vector signed int)__b); 8940 #ifdef __LITTLE_ENDIAN__ 8941 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8942 (vector signed int)__leftelt, 8943 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8944 return (vector unsigned long long)__builtin_shufflevector(__rightelt, 8945 __leftelt, 0, 2); 8946 #else 8947 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8948 (vector signed int)__leftelt, 8949 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8950 return (vector unsigned long long)__builtin_shufflevector(__leftelt, 8951 __rightelt, 1, 3); 8952 #endif 8953 } 8954 8955 static __inline__ vector long long __ATTRS_o_ai 8956 vec_sl(vector long long __a, vector unsigned long long __b) { 8957 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8958 } 8959 #endif /* __VSX__ */ 8960 8961 /* vec_vslb */ 8962 8963 #define __builtin_altivec_vslb vec_vslb 8964 8965 static __inline__ vector signed char __ATTRS_o_ai 8966 vec_vslb(vector signed char __a, vector unsigned char __b) { 8967 return vec_sl(__a, __b); 8968 } 8969 8970 static __inline__ vector unsigned char __ATTRS_o_ai 8971 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8972 return vec_sl(__a, __b); 8973 } 8974 8975 /* vec_vslh */ 8976 8977 #define __builtin_altivec_vslh vec_vslh 8978 8979 static __inline__ vector short __ATTRS_o_ai 8980 vec_vslh(vector short __a, vector unsigned short __b) { 8981 return vec_sl(__a, __b); 8982 } 8983 8984 static __inline__ vector unsigned short __ATTRS_o_ai 8985 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8986 return vec_sl(__a, __b); 8987 } 8988 8989 /* vec_vslw */ 8990 8991 #define __builtin_altivec_vslw vec_vslw 8992 8993 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8994 vector unsigned int __b) { 8995 return vec_sl(__a, __b); 8996 } 8997 8998 static __inline__ vector unsigned int __ATTRS_o_ai 8999 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 9000 return vec_sl(__a, __b); 9001 } 9002 9003 /* vec_sld */ 9004 9005 #define __builtin_altivec_vsldoi_4si vec_sld 9006 9007 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 9008 vector signed char __a, vector signed char __b, unsigned const int __c) { 9009 unsigned char __d = __c & 0x0F; 9010 #ifdef __LITTLE_ENDIAN__ 9011 return vec_perm( 9012 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9013 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9014 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9015 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9016 #else 9017 return vec_perm( 9018 __a, __b, 9019 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9020 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9021 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9022 #endif 9023 } 9024 9025 static __inline__ vector unsigned char __ATTRS_o_ai 9026 vec_sld(vector unsigned char __a, vector unsigned char __b, 9027 unsigned const int __c) { 9028 unsigned char __d = __c & 0x0F; 9029 #ifdef __LITTLE_ENDIAN__ 9030 return vec_perm( 9031 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9032 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9033 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9034 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9035 #else 9036 return vec_perm( 9037 __a, __b, 9038 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9039 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9040 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9041 #endif 9042 } 9043 9044 static __inline__ vector bool char __ATTRS_o_ai 9045 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 9046 unsigned char __d = __c & 0x0F; 9047 #ifdef __LITTLE_ENDIAN__ 9048 return vec_perm( 9049 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9050 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9051 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9052 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9053 #else 9054 return vec_perm( 9055 __a, __b, 9056 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9057 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9058 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9059 #endif 9060 } 9061 9062 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 9063 vector signed short __a, vector signed short __b, unsigned const int __c) { 9064 unsigned char __d = __c & 0x0F; 9065 #ifdef __LITTLE_ENDIAN__ 9066 return vec_perm( 9067 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9068 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9069 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9070 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9071 #else 9072 return vec_perm( 9073 __a, __b, 9074 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9075 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9076 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9077 #endif 9078 } 9079 9080 static __inline__ vector unsigned short __ATTRS_o_ai 9081 vec_sld(vector unsigned short __a, vector unsigned short __b, 9082 unsigned const int __c) { 9083 unsigned char __d = __c & 0x0F; 9084 #ifdef __LITTLE_ENDIAN__ 9085 return vec_perm( 9086 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9087 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9088 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9089 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9090 #else 9091 return vec_perm( 9092 __a, __b, 9093 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9094 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9095 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9096 #endif 9097 } 9098 9099 static __inline__ vector bool short __ATTRS_o_ai 9100 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 9101 unsigned char __d = __c & 0x0F; 9102 #ifdef __LITTLE_ENDIAN__ 9103 return vec_perm( 9104 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9105 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9106 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9107 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9108 #else 9109 return vec_perm( 9110 __a, __b, 9111 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9112 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9113 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9114 #endif 9115 } 9116 9117 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 9118 vector pixel __b, 9119 unsigned const int __c) { 9120 unsigned char __d = __c & 0x0F; 9121 #ifdef __LITTLE_ENDIAN__ 9122 return vec_perm( 9123 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9124 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9125 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9126 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9127 #else 9128 return vec_perm( 9129 __a, __b, 9130 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9131 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9132 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9133 #endif 9134 } 9135 9136 static __inline__ vector signed int __ATTRS_o_ai 9137 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 9138 unsigned char __d = __c & 0x0F; 9139 #ifdef __LITTLE_ENDIAN__ 9140 return vec_perm( 9141 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9142 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9143 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9144 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9145 #else 9146 return vec_perm( 9147 __a, __b, 9148 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9149 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9150 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9151 #endif 9152 } 9153 9154 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 9155 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9156 unsigned char __d = __c & 0x0F; 9157 #ifdef __LITTLE_ENDIAN__ 9158 return vec_perm( 9159 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9160 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9161 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9162 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9163 #else 9164 return vec_perm( 9165 __a, __b, 9166 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9167 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9168 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9169 #endif 9170 } 9171 9172 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 9173 vector bool int __b, 9174 unsigned const int __c) { 9175 unsigned char __d = __c & 0x0F; 9176 #ifdef __LITTLE_ENDIAN__ 9177 return vec_perm( 9178 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9179 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9180 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9181 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9182 #else 9183 return vec_perm( 9184 __a, __b, 9185 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9186 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9187 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9188 #endif 9189 } 9190 9191 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 9192 vector float __b, 9193 unsigned const int __c) { 9194 unsigned char __d = __c & 0x0F; 9195 #ifdef __LITTLE_ENDIAN__ 9196 return vec_perm( 9197 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9198 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9199 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9200 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9201 #else 9202 return vec_perm( 9203 __a, __b, 9204 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9205 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9206 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9207 #endif 9208 } 9209 9210 #ifdef __VSX__ 9211 static __inline__ vector bool long long __ATTRS_o_ai 9212 vec_sld(vector bool long long __a, vector bool long long __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 9230 static __inline__ vector signed long long __ATTRS_o_ai 9231 vec_sld(vector signed long long __a, vector signed long long __b, 9232 unsigned const int __c) { 9233 unsigned char __d = __c & 0x0F; 9234 #ifdef __LITTLE_ENDIAN__ 9235 return vec_perm( 9236 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9237 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9238 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9239 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9240 #else 9241 return vec_perm( 9242 __a, __b, 9243 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9244 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9245 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9246 #endif 9247 } 9248 9249 static __inline__ vector unsigned long long __ATTRS_o_ai 9250 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 9251 unsigned const int __c) { 9252 unsigned char __d = __c & 0x0F; 9253 #ifdef __LITTLE_ENDIAN__ 9254 return vec_perm( 9255 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9256 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9257 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9258 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9259 #else 9260 return vec_perm( 9261 __a, __b, 9262 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9263 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9264 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9265 #endif 9266 } 9267 9268 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 9269 vector double __b, 9270 unsigned const int __c) { 9271 unsigned char __d = __c & 0x0F; 9272 #ifdef __LITTLE_ENDIAN__ 9273 return vec_perm( 9274 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9275 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9276 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9277 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9278 #else 9279 return vec_perm( 9280 __a, __b, 9281 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9282 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9283 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9284 #endif 9285 } 9286 #endif 9287 9288 /* vec_sldw */ 9289 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 9290 vector signed char __a, vector signed char __b, unsigned const int __c) { 9291 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9292 } 9293 9294 static __inline__ vector unsigned char __ATTRS_o_ai 9295 vec_sldw(vector unsigned char __a, vector unsigned char __b, 9296 unsigned const int __c) { 9297 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9298 } 9299 9300 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 9301 vector signed short __a, vector signed short __b, unsigned const int __c) { 9302 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9303 } 9304 9305 static __inline__ vector unsigned short __ATTRS_o_ai 9306 vec_sldw(vector unsigned short __a, vector unsigned short __b, 9307 unsigned const int __c) { 9308 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9309 } 9310 9311 static __inline__ vector signed int __ATTRS_o_ai 9312 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 9313 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9314 } 9315 9316 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 9317 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9318 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9319 } 9320 9321 static __inline__ vector float __ATTRS_o_ai vec_sldw( 9322 vector float __a, vector float __b, unsigned const int __c) { 9323 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9324 } 9325 9326 #ifdef __VSX__ 9327 static __inline__ vector signed long long __ATTRS_o_ai 9328 vec_sldw(vector signed long long __a, vector signed long long __b, 9329 unsigned const int __c) { 9330 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9331 } 9332 9333 static __inline__ vector unsigned long long __ATTRS_o_ai 9334 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 9335 unsigned const int __c) { 9336 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9337 } 9338 9339 static __inline__ vector double __ATTRS_o_ai vec_sldw( 9340 vector double __a, vector double __b, unsigned const int __c) { 9341 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9342 } 9343 #endif 9344 9345 #ifdef __POWER9_VECTOR__ 9346 /* vec_slv */ 9347 static __inline__ vector unsigned char __ATTRS_o_ai 9348 vec_slv(vector unsigned char __a, vector unsigned char __b) { 9349 return __builtin_altivec_vslv(__a, __b); 9350 } 9351 9352 /* vec_srv */ 9353 static __inline__ vector unsigned char __ATTRS_o_ai 9354 vec_srv(vector unsigned char __a, vector unsigned char __b) { 9355 return __builtin_altivec_vsrv(__a, __b); 9356 } 9357 #endif 9358 9359 /* vec_vsldoi */ 9360 9361 static __inline__ vector signed char __ATTRS_o_ai 9362 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 9363 unsigned char __d = __c & 0x0F; 9364 #ifdef __LITTLE_ENDIAN__ 9365 return vec_perm( 9366 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9367 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9368 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9369 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9370 #else 9371 return vec_perm( 9372 __a, __b, 9373 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9374 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9375 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9376 #endif 9377 } 9378 9379 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 9380 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 9381 unsigned char __d = __c & 0x0F; 9382 #ifdef __LITTLE_ENDIAN__ 9383 return vec_perm( 9384 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9385 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9386 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9387 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9388 #else 9389 return vec_perm( 9390 __a, __b, 9391 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9392 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9393 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9394 #endif 9395 } 9396 9397 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 9398 vector short __b, 9399 unsigned char __c) { 9400 unsigned char __d = __c & 0x0F; 9401 #ifdef __LITTLE_ENDIAN__ 9402 return vec_perm( 9403 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9404 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9405 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9406 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9407 #else 9408 return vec_perm( 9409 __a, __b, 9410 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9411 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9412 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9413 #endif 9414 } 9415 9416 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 9417 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 9418 unsigned char __d = __c & 0x0F; 9419 #ifdef __LITTLE_ENDIAN__ 9420 return vec_perm( 9421 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9422 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9423 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9424 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9425 #else 9426 return vec_perm( 9427 __a, __b, 9428 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9429 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9430 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9431 #endif 9432 } 9433 9434 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 9435 vector pixel __b, 9436 unsigned char __c) { 9437 unsigned char __d = __c & 0x0F; 9438 #ifdef __LITTLE_ENDIAN__ 9439 return vec_perm( 9440 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9441 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9442 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9443 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9444 #else 9445 return vec_perm( 9446 __a, __b, 9447 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9448 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9449 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9450 #endif 9451 } 9452 9453 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 9454 vector int __b, 9455 unsigned char __c) { 9456 unsigned char __d = __c & 0x0F; 9457 #ifdef __LITTLE_ENDIAN__ 9458 return vec_perm( 9459 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9460 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9461 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9462 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9463 #else 9464 return vec_perm( 9465 __a, __b, 9466 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9467 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9468 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9469 #endif 9470 } 9471 9472 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 9473 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 9474 unsigned char __d = __c & 0x0F; 9475 #ifdef __LITTLE_ENDIAN__ 9476 return vec_perm( 9477 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9478 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9479 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9480 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9481 #else 9482 return vec_perm( 9483 __a, __b, 9484 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9485 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9486 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9487 #endif 9488 } 9489 9490 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 9491 vector float __b, 9492 unsigned char __c) { 9493 unsigned char __d = __c & 0x0F; 9494 #ifdef __LITTLE_ENDIAN__ 9495 return vec_perm( 9496 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9497 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9498 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9499 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9500 #else 9501 return vec_perm( 9502 __a, __b, 9503 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9504 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9505 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9506 #endif 9507 } 9508 9509 /* vec_sll */ 9510 9511 static __inline__ vector signed char __ATTRS_o_ai 9512 vec_sll(vector signed char __a, vector unsigned char __b) { 9513 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9514 (vector int)__b); 9515 } 9516 9517 static __inline__ vector signed char __ATTRS_o_ai 9518 vec_sll(vector signed char __a, vector unsigned short __b) { 9519 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9520 (vector int)__b); 9521 } 9522 9523 static __inline__ vector signed char __ATTRS_o_ai 9524 vec_sll(vector signed char __a, vector unsigned int __b) { 9525 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9526 (vector int)__b); 9527 } 9528 9529 static __inline__ vector unsigned char __ATTRS_o_ai 9530 vec_sll(vector unsigned char __a, vector unsigned char __b) { 9531 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9532 (vector int)__b); 9533 } 9534 9535 static __inline__ vector unsigned char __ATTRS_o_ai 9536 vec_sll(vector unsigned char __a, vector unsigned short __b) { 9537 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9538 (vector int)__b); 9539 } 9540 9541 static __inline__ vector unsigned char __ATTRS_o_ai 9542 vec_sll(vector unsigned char __a, vector unsigned int __b) { 9543 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9544 (vector int)__b); 9545 } 9546 9547 static __inline__ vector bool char __ATTRS_o_ai 9548 vec_sll(vector bool char __a, vector unsigned char __b) { 9549 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9550 (vector int)__b); 9551 } 9552 9553 static __inline__ vector bool char __ATTRS_o_ai 9554 vec_sll(vector bool char __a, vector unsigned short __b) { 9555 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9556 (vector int)__b); 9557 } 9558 9559 static __inline__ vector bool char __ATTRS_o_ai 9560 vec_sll(vector bool char __a, vector unsigned int __b) { 9561 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9562 (vector int)__b); 9563 } 9564 9565 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9566 vector unsigned char __b) { 9567 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9568 } 9569 9570 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9571 vector unsigned short __b) { 9572 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9573 } 9574 9575 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9576 vector unsigned int __b) { 9577 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9578 } 9579 9580 static __inline__ vector unsigned short __ATTRS_o_ai 9581 vec_sll(vector unsigned short __a, vector unsigned char __b) { 9582 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9583 (vector int)__b); 9584 } 9585 9586 static __inline__ vector unsigned short __ATTRS_o_ai 9587 vec_sll(vector unsigned short __a, vector unsigned short __b) { 9588 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9589 (vector int)__b); 9590 } 9591 9592 static __inline__ vector unsigned short __ATTRS_o_ai 9593 vec_sll(vector unsigned short __a, vector unsigned int __b) { 9594 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9595 (vector int)__b); 9596 } 9597 9598 static __inline__ vector bool short __ATTRS_o_ai 9599 vec_sll(vector bool short __a, vector unsigned char __b) { 9600 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9601 (vector int)__b); 9602 } 9603 9604 static __inline__ vector bool short __ATTRS_o_ai 9605 vec_sll(vector bool short __a, vector unsigned short __b) { 9606 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9607 (vector int)__b); 9608 } 9609 9610 static __inline__ vector bool short __ATTRS_o_ai 9611 vec_sll(vector bool short __a, vector unsigned int __b) { 9612 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9613 (vector int)__b); 9614 } 9615 9616 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9617 vector unsigned char __b) { 9618 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9619 } 9620 9621 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9622 vector unsigned short __b) { 9623 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9624 } 9625 9626 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9627 vector unsigned int __b) { 9628 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9629 } 9630 9631 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9632 vector unsigned char __b) { 9633 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9634 } 9635 9636 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9637 vector unsigned short __b) { 9638 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9639 } 9640 9641 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9642 vector unsigned int __b) { 9643 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9644 } 9645 9646 static __inline__ vector unsigned int __ATTRS_o_ai 9647 vec_sll(vector unsigned int __a, vector unsigned char __b) { 9648 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9649 (vector int)__b); 9650 } 9651 9652 static __inline__ vector unsigned int __ATTRS_o_ai 9653 vec_sll(vector unsigned int __a, vector unsigned short __b) { 9654 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9655 (vector int)__b); 9656 } 9657 9658 static __inline__ vector unsigned int __ATTRS_o_ai 9659 vec_sll(vector unsigned int __a, vector unsigned int __b) { 9660 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9661 (vector int)__b); 9662 } 9663 9664 static __inline__ vector bool int __ATTRS_o_ai 9665 vec_sll(vector bool int __a, vector unsigned char __b) { 9666 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9667 (vector int)__b); 9668 } 9669 9670 static __inline__ vector bool int __ATTRS_o_ai 9671 vec_sll(vector bool int __a, vector unsigned short __b) { 9672 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9673 (vector int)__b); 9674 } 9675 9676 static __inline__ vector bool int __ATTRS_o_ai 9677 vec_sll(vector bool int __a, vector unsigned int __b) { 9678 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9679 (vector int)__b); 9680 } 9681 9682 #ifdef __VSX__ 9683 static __inline__ vector signed long long __ATTRS_o_ai 9684 vec_sll(vector signed long long __a, vector unsigned char __b) { 9685 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 9686 (vector int)__b); 9687 } 9688 9689 static __inline__ vector unsigned long long __ATTRS_o_ai 9690 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 9691 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 9692 (vector int)__b); 9693 } 9694 #endif 9695 9696 /* vec_vsl */ 9697 9698 static __inline__ vector signed char __ATTRS_o_ai 9699 vec_vsl(vector signed char __a, vector unsigned char __b) { 9700 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9701 (vector int)__b); 9702 } 9703 9704 static __inline__ vector signed char __ATTRS_o_ai 9705 vec_vsl(vector signed char __a, vector unsigned short __b) { 9706 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9707 (vector int)__b); 9708 } 9709 9710 static __inline__ vector signed char __ATTRS_o_ai 9711 vec_vsl(vector signed char __a, vector unsigned int __b) { 9712 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9713 (vector int)__b); 9714 } 9715 9716 static __inline__ vector unsigned char __ATTRS_o_ai 9717 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 9718 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9719 (vector int)__b); 9720 } 9721 9722 static __inline__ vector unsigned char __ATTRS_o_ai 9723 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 9724 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9725 (vector int)__b); 9726 } 9727 9728 static __inline__ vector unsigned char __ATTRS_o_ai 9729 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 9730 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9731 (vector int)__b); 9732 } 9733 9734 static __inline__ vector bool char __ATTRS_o_ai 9735 vec_vsl(vector bool char __a, vector unsigned char __b) { 9736 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9737 (vector int)__b); 9738 } 9739 9740 static __inline__ vector bool char __ATTRS_o_ai 9741 vec_vsl(vector bool char __a, vector unsigned short __b) { 9742 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9743 (vector int)__b); 9744 } 9745 9746 static __inline__ vector bool char __ATTRS_o_ai 9747 vec_vsl(vector bool char __a, vector unsigned int __b) { 9748 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9749 (vector int)__b); 9750 } 9751 9752 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9753 vector unsigned char __b) { 9754 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9755 } 9756 9757 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9758 vector unsigned short __b) { 9759 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9760 } 9761 9762 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9763 vector unsigned int __b) { 9764 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9765 } 9766 9767 static __inline__ vector unsigned short __ATTRS_o_ai 9768 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 9769 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9770 (vector int)__b); 9771 } 9772 9773 static __inline__ vector unsigned short __ATTRS_o_ai 9774 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 9775 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9776 (vector int)__b); 9777 } 9778 9779 static __inline__ vector unsigned short __ATTRS_o_ai 9780 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 9781 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9782 (vector int)__b); 9783 } 9784 9785 static __inline__ vector bool short __ATTRS_o_ai 9786 vec_vsl(vector bool short __a, vector unsigned char __b) { 9787 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9788 (vector int)__b); 9789 } 9790 9791 static __inline__ vector bool short __ATTRS_o_ai 9792 vec_vsl(vector bool short __a, vector unsigned short __b) { 9793 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9794 (vector int)__b); 9795 } 9796 9797 static __inline__ vector bool short __ATTRS_o_ai 9798 vec_vsl(vector bool short __a, vector unsigned int __b) { 9799 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9800 (vector int)__b); 9801 } 9802 9803 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9804 vector unsigned char __b) { 9805 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9806 } 9807 9808 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9809 vector unsigned short __b) { 9810 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9811 } 9812 9813 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9814 vector unsigned int __b) { 9815 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9816 } 9817 9818 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9819 vector unsigned char __b) { 9820 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9821 } 9822 9823 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9824 vector unsigned short __b) { 9825 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9826 } 9827 9828 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9829 vector unsigned int __b) { 9830 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9831 } 9832 9833 static __inline__ vector unsigned int __ATTRS_o_ai 9834 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 9835 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9836 (vector int)__b); 9837 } 9838 9839 static __inline__ vector unsigned int __ATTRS_o_ai 9840 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9841 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9842 (vector int)__b); 9843 } 9844 9845 static __inline__ vector unsigned int __ATTRS_o_ai 9846 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9847 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9848 (vector int)__b); 9849 } 9850 9851 static __inline__ vector bool int __ATTRS_o_ai 9852 vec_vsl(vector bool int __a, vector unsigned char __b) { 9853 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9854 (vector int)__b); 9855 } 9856 9857 static __inline__ vector bool int __ATTRS_o_ai 9858 vec_vsl(vector bool int __a, vector unsigned short __b) { 9859 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9860 (vector int)__b); 9861 } 9862 9863 static __inline__ vector bool int __ATTRS_o_ai 9864 vec_vsl(vector bool int __a, vector unsigned int __b) { 9865 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9866 (vector int)__b); 9867 } 9868 9869 /* vec_slo */ 9870 9871 static __inline__ vector signed char __ATTRS_o_ai 9872 vec_slo(vector signed char __a, vector signed char __b) { 9873 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9874 (vector int)__b); 9875 } 9876 9877 static __inline__ vector signed char __ATTRS_o_ai 9878 vec_slo(vector signed char __a, vector unsigned char __b) { 9879 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9880 (vector int)__b); 9881 } 9882 9883 static __inline__ vector unsigned char __ATTRS_o_ai 9884 vec_slo(vector unsigned char __a, vector signed char __b) { 9885 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9886 (vector int)__b); 9887 } 9888 9889 static __inline__ vector unsigned char __ATTRS_o_ai 9890 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9891 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9892 (vector int)__b); 9893 } 9894 9895 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9896 vector signed char __b) { 9897 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9898 } 9899 9900 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9901 vector unsigned char __b) { 9902 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9903 } 9904 9905 static __inline__ vector unsigned short __ATTRS_o_ai 9906 vec_slo(vector unsigned short __a, vector signed char __b) { 9907 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9908 (vector int)__b); 9909 } 9910 9911 static __inline__ vector unsigned short __ATTRS_o_ai 9912 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9913 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9914 (vector int)__b); 9915 } 9916 9917 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9918 vector signed char __b) { 9919 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9920 } 9921 9922 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9923 vector unsigned char __b) { 9924 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9925 } 9926 9927 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9928 vector signed char __b) { 9929 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9930 } 9931 9932 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9933 vector unsigned char __b) { 9934 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9935 } 9936 9937 static __inline__ vector unsigned int __ATTRS_o_ai 9938 vec_slo(vector unsigned int __a, vector signed char __b) { 9939 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9940 (vector int)__b); 9941 } 9942 9943 static __inline__ vector unsigned int __ATTRS_o_ai 9944 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9945 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9946 (vector int)__b); 9947 } 9948 9949 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9950 vector signed char __b) { 9951 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9952 } 9953 9954 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9955 vector unsigned char __b) { 9956 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9957 } 9958 9959 #ifdef __VSX__ 9960 static __inline__ vector signed long long __ATTRS_o_ai 9961 vec_slo(vector signed long long __a, vector signed char __b) { 9962 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9963 (vector int)__b); 9964 } 9965 9966 static __inline__ vector signed long long __ATTRS_o_ai 9967 vec_slo(vector signed long long __a, vector unsigned char __b) { 9968 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9969 (vector int)__b); 9970 } 9971 9972 static __inline__ vector unsigned long long __ATTRS_o_ai 9973 vec_slo(vector unsigned long long __a, vector signed char __b) { 9974 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9975 (vector int)__b); 9976 } 9977 9978 static __inline__ vector unsigned long long __ATTRS_o_ai 9979 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9980 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9981 (vector int)__b); 9982 } 9983 #endif 9984 9985 /* vec_vslo */ 9986 9987 static __inline__ vector signed char __ATTRS_o_ai 9988 vec_vslo(vector signed char __a, vector signed char __b) { 9989 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9990 (vector int)__b); 9991 } 9992 9993 static __inline__ vector signed char __ATTRS_o_ai 9994 vec_vslo(vector signed char __a, vector unsigned char __b) { 9995 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9996 (vector int)__b); 9997 } 9998 9999 static __inline__ vector unsigned char __ATTRS_o_ai 10000 vec_vslo(vector unsigned char __a, vector signed char __b) { 10001 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 10002 (vector int)__b); 10003 } 10004 10005 static __inline__ vector unsigned char __ATTRS_o_ai 10006 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 10007 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 10008 (vector int)__b); 10009 } 10010 10011 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 10012 vector signed char __b) { 10013 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10014 } 10015 10016 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 10017 vector unsigned char __b) { 10018 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10019 } 10020 10021 static __inline__ vector unsigned short __ATTRS_o_ai 10022 vec_vslo(vector unsigned short __a, vector signed char __b) { 10023 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 10024 (vector int)__b); 10025 } 10026 10027 static __inline__ vector unsigned short __ATTRS_o_ai 10028 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 10029 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 10030 (vector int)__b); 10031 } 10032 10033 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 10034 vector signed char __b) { 10035 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10036 } 10037 10038 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 10039 vector unsigned char __b) { 10040 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10041 } 10042 10043 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 10044 vector signed char __b) { 10045 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 10046 } 10047 10048 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 10049 vector unsigned char __b) { 10050 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 10051 } 10052 10053 static __inline__ vector unsigned int __ATTRS_o_ai 10054 vec_vslo(vector unsigned int __a, vector signed char __b) { 10055 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 10056 (vector int)__b); 10057 } 10058 10059 static __inline__ vector unsigned int __ATTRS_o_ai 10060 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 10061 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 10062 (vector int)__b); 10063 } 10064 10065 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10066 vector signed char __b) { 10067 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10068 } 10069 10070 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10071 vector unsigned char __b) { 10072 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10073 } 10074 10075 /* vec_splat */ 10076 10077 static __inline__ vector signed char __ATTRS_o_ai 10078 vec_splat(vector signed char __a, unsigned const int __b) { 10079 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10080 } 10081 10082 static __inline__ vector unsigned char __ATTRS_o_ai 10083 vec_splat(vector unsigned char __a, unsigned const int __b) { 10084 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10085 } 10086 10087 static __inline__ vector bool char __ATTRS_o_ai 10088 vec_splat(vector bool char __a, unsigned const int __b) { 10089 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10090 } 10091 10092 static __inline__ vector signed short __ATTRS_o_ai 10093 vec_splat(vector signed short __a, unsigned const int __b) { 10094 unsigned char b0 = (__b & 0x07) * 2; 10095 unsigned char b1 = b0 + 1; 10096 return vec_perm(__a, __a, 10097 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10098 b0, b1, b0, b1, b0, b1)); 10099 } 10100 10101 static __inline__ vector unsigned short __ATTRS_o_ai 10102 vec_splat(vector unsigned short __a, unsigned const int __b) { 10103 unsigned char b0 = (__b & 0x07) * 2; 10104 unsigned char b1 = b0 + 1; 10105 return vec_perm(__a, __a, 10106 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10107 b0, b1, b0, b1, b0, b1)); 10108 } 10109 10110 static __inline__ vector bool short __ATTRS_o_ai 10111 vec_splat(vector bool short __a, unsigned const int __b) { 10112 unsigned char b0 = (__b & 0x07) * 2; 10113 unsigned char b1 = b0 + 1; 10114 return vec_perm(__a, __a, 10115 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10116 b0, b1, b0, b1, b0, b1)); 10117 } 10118 10119 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 10120 unsigned const int __b) { 10121 unsigned char b0 = (__b & 0x07) * 2; 10122 unsigned char b1 = b0 + 1; 10123 return vec_perm(__a, __a, 10124 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10125 b0, b1, b0, b1, b0, b1)); 10126 } 10127 10128 static __inline__ vector signed int __ATTRS_o_ai 10129 vec_splat(vector signed int __a, unsigned const int __b) { 10130 unsigned char b0 = (__b & 0x03) * 4; 10131 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10132 return vec_perm(__a, __a, 10133 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10134 b2, b3, b0, b1, b2, b3)); 10135 } 10136 10137 static __inline__ vector unsigned int __ATTRS_o_ai 10138 vec_splat(vector unsigned int __a, unsigned const int __b) { 10139 unsigned char b0 = (__b & 0x03) * 4; 10140 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10141 return vec_perm(__a, __a, 10142 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10143 b2, b3, b0, b1, b2, b3)); 10144 } 10145 10146 static __inline__ vector bool int __ATTRS_o_ai 10147 vec_splat(vector bool int __a, unsigned const int __b) { 10148 unsigned char b0 = (__b & 0x03) * 4; 10149 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10150 return vec_perm(__a, __a, 10151 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10152 b2, b3, b0, b1, b2, b3)); 10153 } 10154 10155 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 10156 unsigned const int __b) { 10157 unsigned char b0 = (__b & 0x03) * 4; 10158 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10159 return vec_perm(__a, __a, 10160 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10161 b2, b3, b0, b1, b2, b3)); 10162 } 10163 10164 #ifdef __VSX__ 10165 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 10166 unsigned const int __b) { 10167 unsigned char b0 = (__b & 0x01) * 8; 10168 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10169 b6 = b0 + 6, b7 = b0 + 7; 10170 return vec_perm(__a, __a, 10171 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10172 b2, b3, b4, b5, b6, b7)); 10173 } 10174 static __inline__ vector bool long long __ATTRS_o_ai 10175 vec_splat(vector bool long long __a, unsigned const int __b) { 10176 unsigned char b0 = (__b & 0x01) * 8; 10177 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10178 b6 = b0 + 6, b7 = b0 + 7; 10179 return vec_perm(__a, __a, 10180 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10181 b2, b3, b4, b5, b6, b7)); 10182 } 10183 static __inline__ vector signed long long __ATTRS_o_ai 10184 vec_splat(vector signed long long __a, unsigned const int __b) { 10185 unsigned char b0 = (__b & 0x01) * 8; 10186 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10187 b6 = b0 + 6, b7 = b0 + 7; 10188 return vec_perm(__a, __a, 10189 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10190 b2, b3, b4, b5, b6, b7)); 10191 } 10192 static __inline__ vector unsigned long long __ATTRS_o_ai 10193 vec_splat(vector unsigned long long __a, unsigned const int __b) { 10194 unsigned char b0 = (__b & 0x01) * 8; 10195 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10196 b6 = b0 + 6, b7 = b0 + 7; 10197 return vec_perm(__a, __a, 10198 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10199 b2, b3, b4, b5, b6, b7)); 10200 } 10201 #endif 10202 10203 /* vec_vspltb */ 10204 10205 #define __builtin_altivec_vspltb vec_vspltb 10206 10207 static __inline__ vector signed char __ATTRS_o_ai 10208 vec_vspltb(vector signed char __a, unsigned char __b) { 10209 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10210 } 10211 10212 static __inline__ vector unsigned char __ATTRS_o_ai 10213 vec_vspltb(vector unsigned char __a, unsigned char __b) { 10214 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10215 } 10216 10217 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 10218 unsigned char __b) { 10219 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10220 } 10221 10222 /* vec_vsplth */ 10223 10224 #define __builtin_altivec_vsplth vec_vsplth 10225 10226 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 10227 unsigned char __b) { 10228 __b *= 2; 10229 unsigned char b1 = __b + 1; 10230 return vec_perm(__a, __a, 10231 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10232 __b, b1, __b, b1, __b, b1, __b, b1)); 10233 } 10234 10235 static __inline__ vector unsigned short __ATTRS_o_ai 10236 vec_vsplth(vector unsigned short __a, unsigned char __b) { 10237 __b *= 2; 10238 unsigned char b1 = __b + 1; 10239 return vec_perm(__a, __a, 10240 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10241 __b, b1, __b, b1, __b, b1, __b, b1)); 10242 } 10243 10244 static __inline__ vector bool short __ATTRS_o_ai 10245 vec_vsplth(vector bool short __a, unsigned char __b) { 10246 __b *= 2; 10247 unsigned char b1 = __b + 1; 10248 return vec_perm(__a, __a, 10249 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10250 __b, b1, __b, b1, __b, b1, __b, b1)); 10251 } 10252 10253 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 10254 unsigned char __b) { 10255 __b *= 2; 10256 unsigned char b1 = __b + 1; 10257 return vec_perm(__a, __a, 10258 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10259 __b, b1, __b, b1, __b, b1, __b, b1)); 10260 } 10261 10262 /* vec_vspltw */ 10263 10264 #define __builtin_altivec_vspltw vec_vspltw 10265 10266 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 10267 unsigned char __b) { 10268 __b *= 4; 10269 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10270 return vec_perm(__a, __a, 10271 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10272 b1, b2, b3, __b, b1, b2, b3)); 10273 } 10274 10275 static __inline__ vector unsigned int __ATTRS_o_ai 10276 vec_vspltw(vector unsigned int __a, unsigned char __b) { 10277 __b *= 4; 10278 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10279 return vec_perm(__a, __a, 10280 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10281 b1, b2, b3, __b, b1, b2, b3)); 10282 } 10283 10284 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 10285 unsigned char __b) { 10286 __b *= 4; 10287 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10288 return vec_perm(__a, __a, 10289 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10290 b1, b2, b3, __b, b1, b2, b3)); 10291 } 10292 10293 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 10294 unsigned char __b) { 10295 __b *= 4; 10296 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10297 return vec_perm(__a, __a, 10298 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10299 b1, b2, b3, __b, b1, b2, b3)); 10300 } 10301 10302 /* vec_splat_s8 */ 10303 10304 #define __builtin_altivec_vspltisb vec_splat_s8 10305 10306 // FIXME: parameter should be treated as 5-bit signed literal 10307 static __inline__ vector signed char __ATTRS_o_ai 10308 vec_splat_s8(signed char __a) { 10309 return (vector signed char)(__a); 10310 } 10311 10312 /* vec_vspltisb */ 10313 10314 // FIXME: parameter should be treated as 5-bit signed literal 10315 static __inline__ vector signed char __ATTRS_o_ai 10316 vec_vspltisb(signed char __a) { 10317 return (vector signed char)(__a); 10318 } 10319 10320 /* vec_splat_s16 */ 10321 10322 #define __builtin_altivec_vspltish vec_splat_s16 10323 10324 // FIXME: parameter should be treated as 5-bit signed literal 10325 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 10326 return (vector short)(__a); 10327 } 10328 10329 /* vec_vspltish */ 10330 10331 // FIXME: parameter should be treated as 5-bit signed literal 10332 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 10333 return (vector short)(__a); 10334 } 10335 10336 /* vec_splat_s32 */ 10337 10338 #define __builtin_altivec_vspltisw vec_splat_s32 10339 10340 // FIXME: parameter should be treated as 5-bit signed literal 10341 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 10342 return (vector int)(__a); 10343 } 10344 10345 /* vec_vspltisw */ 10346 10347 // FIXME: parameter should be treated as 5-bit signed literal 10348 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 10349 return (vector int)(__a); 10350 } 10351 10352 /* vec_splat_u8 */ 10353 10354 // FIXME: parameter should be treated as 5-bit signed literal 10355 static __inline__ vector unsigned char __ATTRS_o_ai 10356 vec_splat_u8(unsigned char __a) { 10357 return (vector unsigned char)(__a); 10358 } 10359 10360 /* vec_splat_u16 */ 10361 10362 // FIXME: parameter should be treated as 5-bit signed literal 10363 static __inline__ vector unsigned short __ATTRS_o_ai 10364 vec_splat_u16(signed char __a) { 10365 return (vector unsigned short)(__a); 10366 } 10367 10368 /* vec_splat_u32 */ 10369 10370 // FIXME: parameter should be treated as 5-bit signed literal 10371 static __inline__ vector unsigned int __ATTRS_o_ai 10372 vec_splat_u32(signed char __a) { 10373 return (vector unsigned int)(__a); 10374 } 10375 10376 /* vec_sr */ 10377 10378 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 10379 // than the length of __a. 10380 static __inline__ vector unsigned char __ATTRS_o_ai 10381 vec_sr(vector unsigned char __a, vector unsigned char __b) { 10382 return __a >> 10383 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 10384 } 10385 10386 static __inline__ vector signed char __ATTRS_o_ai 10387 vec_sr(vector signed char __a, vector unsigned char __b) { 10388 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 10389 } 10390 10391 static __inline__ vector unsigned short __ATTRS_o_ai 10392 vec_sr(vector unsigned short __a, vector unsigned short __b) { 10393 return __a >> 10394 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 10395 } 10396 10397 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 10398 vector unsigned short __b) { 10399 return (vector short)vec_sr((vector unsigned short)__a, __b); 10400 } 10401 10402 static __inline__ vector unsigned int __ATTRS_o_ai 10403 vec_sr(vector unsigned int __a, vector unsigned int __b) { 10404 return __a >> 10405 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 10406 } 10407 10408 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 10409 vector unsigned int __b) { 10410 return (vector int)vec_sr((vector unsigned int)__a, __b); 10411 } 10412 10413 #ifdef __POWER8_VECTOR__ 10414 static __inline__ vector unsigned long long __ATTRS_o_ai 10415 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10416 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 10417 __CHAR_BIT__)); 10418 } 10419 10420 static __inline__ vector long long __ATTRS_o_ai 10421 vec_sr(vector long long __a, vector unsigned long long __b) { 10422 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10423 } 10424 #elif defined(__VSX__) 10425 static __inline__ vector unsigned long long __ATTRS_o_ai 10426 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10427 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10428 10429 // Big endian element zero (the left doubleword) can be right shifted as-is. 10430 // However the shift amount must be in the right doubleword. 10431 // The other element needs to be swapped into the left doubleword and 10432 // shifted. Then the left doublewords of the two result vectors are merged. 10433 vector unsigned long long __swapshift = 10434 __builtin_shufflevector(__b, __b, 1, 0); 10435 vector unsigned long long __leftelt = 10436 (vector unsigned long long)__builtin_altivec_vsro( 10437 (vector signed int)__a, (vector signed int)__swapshift); 10438 #ifdef __LITTLE_ENDIAN__ 10439 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10440 (vector signed int)__leftelt, 10441 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0)); 10442 #else 10443 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10444 (vector signed int)__leftelt, 10445 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15)); 10446 #endif 10447 __a = __builtin_shufflevector(__a, __a, 1, 0); 10448 vector unsigned long long __rightelt = 10449 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a, 10450 (vector signed int)__b); 10451 #ifdef __LITTLE_ENDIAN__ 10452 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10453 (vector signed int)__rightelt, 10454 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 10455 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3); 10456 #else 10457 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10458 (vector signed int)__rightelt, 10459 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 10460 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2); 10461 #endif 10462 } 10463 10464 static __inline__ vector long long __ATTRS_o_ai 10465 vec_sr(vector long long __a, vector unsigned long long __b) { 10466 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10467 } 10468 #endif /* __VSX__ */ 10469 10470 /* vec_vsrb */ 10471 10472 #define __builtin_altivec_vsrb vec_vsrb 10473 10474 static __inline__ vector signed char __ATTRS_o_ai 10475 vec_vsrb(vector signed char __a, vector unsigned char __b) { 10476 return vec_sr(__a, __b); 10477 } 10478 10479 static __inline__ vector unsigned char __ATTRS_o_ai 10480 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 10481 return vec_sr(__a, __b); 10482 } 10483 10484 /* vec_vsrh */ 10485 10486 #define __builtin_altivec_vsrh vec_vsrh 10487 10488 static __inline__ vector short __ATTRS_o_ai 10489 vec_vsrh(vector short __a, vector unsigned short __b) { 10490 return vec_sr(__a, __b); 10491 } 10492 10493 static __inline__ vector unsigned short __ATTRS_o_ai 10494 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 10495 return vec_sr(__a, __b); 10496 } 10497 10498 /* vec_vsrw */ 10499 10500 #define __builtin_altivec_vsrw vec_vsrw 10501 10502 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 10503 vector unsigned int __b) { 10504 return vec_sr(__a, __b); 10505 } 10506 10507 static __inline__ vector unsigned int __ATTRS_o_ai 10508 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 10509 return vec_sr(__a, __b); 10510 } 10511 10512 /* vec_sra */ 10513 10514 static __inline__ vector signed char __ATTRS_o_ai 10515 vec_sra(vector signed char __a, vector unsigned char __b) { 10516 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10517 } 10518 10519 static __inline__ vector unsigned char __ATTRS_o_ai 10520 vec_sra(vector unsigned char __a, vector unsigned char __b) { 10521 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10522 } 10523 10524 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 10525 vector unsigned short __b) { 10526 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10527 } 10528 10529 static __inline__ vector unsigned short __ATTRS_o_ai 10530 vec_sra(vector unsigned short __a, vector unsigned short __b) { 10531 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10532 } 10533 10534 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 10535 vector unsigned int __b) { 10536 return __builtin_altivec_vsraw(__a, __b); 10537 } 10538 10539 static __inline__ vector unsigned int __ATTRS_o_ai 10540 vec_sra(vector unsigned int __a, vector unsigned int __b) { 10541 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10542 } 10543 10544 #ifdef __POWER8_VECTOR__ 10545 static __inline__ vector signed long long __ATTRS_o_ai 10546 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10547 return __a >> __b; 10548 } 10549 10550 static __inline__ vector unsigned long long __ATTRS_o_ai 10551 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10552 return (vector unsigned long long)((vector signed long long)__a >> __b); 10553 } 10554 #elif defined(__VSX__) 10555 static __inline__ vector signed long long __ATTRS_o_ai 10556 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10557 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10558 return __a >> __b; 10559 } 10560 10561 static __inline__ vector unsigned long long __ATTRS_o_ai 10562 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10563 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10564 return (vector unsigned long long)((vector signed long long)__a >> __b); 10565 } 10566 #endif /* __VSX__ */ 10567 10568 /* vec_vsrab */ 10569 10570 static __inline__ vector signed char __ATTRS_o_ai 10571 vec_vsrab(vector signed char __a, vector unsigned char __b) { 10572 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10573 } 10574 10575 static __inline__ vector unsigned char __ATTRS_o_ai 10576 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 10577 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10578 } 10579 10580 /* vec_vsrah */ 10581 10582 static __inline__ vector short __ATTRS_o_ai 10583 vec_vsrah(vector short __a, vector unsigned short __b) { 10584 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10585 } 10586 10587 static __inline__ vector unsigned short __ATTRS_o_ai 10588 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 10589 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10590 } 10591 10592 /* vec_vsraw */ 10593 10594 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 10595 vector unsigned int __b) { 10596 return __builtin_altivec_vsraw(__a, __b); 10597 } 10598 10599 static __inline__ vector unsigned int __ATTRS_o_ai 10600 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 10601 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10602 } 10603 10604 /* vec_srl */ 10605 10606 static __inline__ vector signed char __ATTRS_o_ai 10607 vec_srl(vector signed char __a, vector unsigned char __b) { 10608 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10609 (vector int)__b); 10610 } 10611 10612 static __inline__ vector signed char __ATTRS_o_ai 10613 vec_srl(vector signed char __a, vector unsigned short __b) { 10614 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10615 (vector int)__b); 10616 } 10617 10618 static __inline__ vector signed char __ATTRS_o_ai 10619 vec_srl(vector signed char __a, vector unsigned int __b) { 10620 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10621 (vector int)__b); 10622 } 10623 10624 static __inline__ vector unsigned char __ATTRS_o_ai 10625 vec_srl(vector unsigned char __a, vector unsigned char __b) { 10626 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10627 (vector int)__b); 10628 } 10629 10630 static __inline__ vector unsigned char __ATTRS_o_ai 10631 vec_srl(vector unsigned char __a, vector unsigned short __b) { 10632 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10633 (vector int)__b); 10634 } 10635 10636 static __inline__ vector unsigned char __ATTRS_o_ai 10637 vec_srl(vector unsigned char __a, vector unsigned int __b) { 10638 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10639 (vector int)__b); 10640 } 10641 10642 static __inline__ vector bool char __ATTRS_o_ai 10643 vec_srl(vector bool char __a, vector unsigned char __b) { 10644 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10645 (vector int)__b); 10646 } 10647 10648 static __inline__ vector bool char __ATTRS_o_ai 10649 vec_srl(vector bool char __a, vector unsigned short __b) { 10650 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10651 (vector int)__b); 10652 } 10653 10654 static __inline__ vector bool char __ATTRS_o_ai 10655 vec_srl(vector bool char __a, vector unsigned int __b) { 10656 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10657 (vector int)__b); 10658 } 10659 10660 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10661 vector unsigned char __b) { 10662 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10663 } 10664 10665 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10666 vector unsigned short __b) { 10667 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10668 } 10669 10670 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10671 vector unsigned int __b) { 10672 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10673 } 10674 10675 static __inline__ vector unsigned short __ATTRS_o_ai 10676 vec_srl(vector unsigned short __a, vector unsigned char __b) { 10677 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10678 (vector int)__b); 10679 } 10680 10681 static __inline__ vector unsigned short __ATTRS_o_ai 10682 vec_srl(vector unsigned short __a, vector unsigned short __b) { 10683 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10684 (vector int)__b); 10685 } 10686 10687 static __inline__ vector unsigned short __ATTRS_o_ai 10688 vec_srl(vector unsigned short __a, vector unsigned int __b) { 10689 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10690 (vector int)__b); 10691 } 10692 10693 static __inline__ vector bool short __ATTRS_o_ai 10694 vec_srl(vector bool short __a, vector unsigned char __b) { 10695 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10696 (vector int)__b); 10697 } 10698 10699 static __inline__ vector bool short __ATTRS_o_ai 10700 vec_srl(vector bool short __a, vector unsigned short __b) { 10701 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10702 (vector int)__b); 10703 } 10704 10705 static __inline__ vector bool short __ATTRS_o_ai 10706 vec_srl(vector bool short __a, vector unsigned int __b) { 10707 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10708 (vector int)__b); 10709 } 10710 10711 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10712 vector unsigned char __b) { 10713 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10714 } 10715 10716 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10717 vector unsigned short __b) { 10718 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10719 } 10720 10721 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10722 vector unsigned int __b) { 10723 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10724 } 10725 10726 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10727 vector unsigned char __b) { 10728 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10729 } 10730 10731 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10732 vector unsigned short __b) { 10733 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10734 } 10735 10736 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10737 vector unsigned int __b) { 10738 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10739 } 10740 10741 static __inline__ vector unsigned int __ATTRS_o_ai 10742 vec_srl(vector unsigned int __a, vector unsigned char __b) { 10743 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10744 (vector int)__b); 10745 } 10746 10747 static __inline__ vector unsigned int __ATTRS_o_ai 10748 vec_srl(vector unsigned int __a, vector unsigned short __b) { 10749 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10750 (vector int)__b); 10751 } 10752 10753 static __inline__ vector unsigned int __ATTRS_o_ai 10754 vec_srl(vector unsigned int __a, vector unsigned int __b) { 10755 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10756 (vector int)__b); 10757 } 10758 10759 static __inline__ vector bool int __ATTRS_o_ai 10760 vec_srl(vector bool int __a, vector unsigned char __b) { 10761 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10762 (vector int)__b); 10763 } 10764 10765 static __inline__ vector bool int __ATTRS_o_ai 10766 vec_srl(vector bool int __a, vector unsigned short __b) { 10767 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10768 (vector int)__b); 10769 } 10770 10771 static __inline__ vector bool int __ATTRS_o_ai 10772 vec_srl(vector bool int __a, vector unsigned int __b) { 10773 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10774 (vector int)__b); 10775 } 10776 10777 #ifdef __VSX__ 10778 static __inline__ vector signed long long __ATTRS_o_ai 10779 vec_srl(vector signed long long __a, vector unsigned char __b) { 10780 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 10781 (vector int)__b); 10782 } 10783 10784 static __inline__ vector unsigned long long __ATTRS_o_ai 10785 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 10786 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 10787 (vector int)__b); 10788 } 10789 #endif 10790 10791 /* vec_vsr */ 10792 10793 static __inline__ vector signed char __ATTRS_o_ai 10794 vec_vsr(vector signed char __a, vector unsigned char __b) { 10795 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10796 (vector int)__b); 10797 } 10798 10799 static __inline__ vector signed char __ATTRS_o_ai 10800 vec_vsr(vector signed char __a, vector unsigned short __b) { 10801 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10802 (vector int)__b); 10803 } 10804 10805 static __inline__ vector signed char __ATTRS_o_ai 10806 vec_vsr(vector signed char __a, vector unsigned int __b) { 10807 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10808 (vector int)__b); 10809 } 10810 10811 static __inline__ vector unsigned char __ATTRS_o_ai 10812 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 10813 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10814 (vector int)__b); 10815 } 10816 10817 static __inline__ vector unsigned char __ATTRS_o_ai 10818 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 10819 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10820 (vector int)__b); 10821 } 10822 10823 static __inline__ vector unsigned char __ATTRS_o_ai 10824 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 10825 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10826 (vector int)__b); 10827 } 10828 10829 static __inline__ vector bool char __ATTRS_o_ai 10830 vec_vsr(vector bool char __a, vector unsigned char __b) { 10831 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10832 (vector int)__b); 10833 } 10834 10835 static __inline__ vector bool char __ATTRS_o_ai 10836 vec_vsr(vector bool char __a, vector unsigned short __b) { 10837 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10838 (vector int)__b); 10839 } 10840 10841 static __inline__ vector bool char __ATTRS_o_ai 10842 vec_vsr(vector bool char __a, vector unsigned int __b) { 10843 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10844 (vector int)__b); 10845 } 10846 10847 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10848 vector unsigned char __b) { 10849 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10850 } 10851 10852 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10853 vector unsigned short __b) { 10854 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10855 } 10856 10857 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10858 vector unsigned int __b) { 10859 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10860 } 10861 10862 static __inline__ vector unsigned short __ATTRS_o_ai 10863 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 10864 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10865 (vector int)__b); 10866 } 10867 10868 static __inline__ vector unsigned short __ATTRS_o_ai 10869 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 10870 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10871 (vector int)__b); 10872 } 10873 10874 static __inline__ vector unsigned short __ATTRS_o_ai 10875 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 10876 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10877 (vector int)__b); 10878 } 10879 10880 static __inline__ vector bool short __ATTRS_o_ai 10881 vec_vsr(vector bool short __a, vector unsigned char __b) { 10882 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10883 (vector int)__b); 10884 } 10885 10886 static __inline__ vector bool short __ATTRS_o_ai 10887 vec_vsr(vector bool short __a, vector unsigned short __b) { 10888 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10889 (vector int)__b); 10890 } 10891 10892 static __inline__ vector bool short __ATTRS_o_ai 10893 vec_vsr(vector bool short __a, vector unsigned int __b) { 10894 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10895 (vector int)__b); 10896 } 10897 10898 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10899 vector unsigned char __b) { 10900 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10901 } 10902 10903 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10904 vector unsigned short __b) { 10905 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10906 } 10907 10908 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10909 vector unsigned int __b) { 10910 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10911 } 10912 10913 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10914 vector unsigned char __b) { 10915 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10916 } 10917 10918 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10919 vector unsigned short __b) { 10920 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10921 } 10922 10923 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10924 vector unsigned int __b) { 10925 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10926 } 10927 10928 static __inline__ vector unsigned int __ATTRS_o_ai 10929 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10930 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10931 (vector int)__b); 10932 } 10933 10934 static __inline__ vector unsigned int __ATTRS_o_ai 10935 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10936 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10937 (vector int)__b); 10938 } 10939 10940 static __inline__ vector unsigned int __ATTRS_o_ai 10941 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10942 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10943 (vector int)__b); 10944 } 10945 10946 static __inline__ vector bool int __ATTRS_o_ai 10947 vec_vsr(vector bool int __a, vector unsigned char __b) { 10948 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10949 (vector int)__b); 10950 } 10951 10952 static __inline__ vector bool int __ATTRS_o_ai 10953 vec_vsr(vector bool int __a, vector unsigned short __b) { 10954 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10955 (vector int)__b); 10956 } 10957 10958 static __inline__ vector bool int __ATTRS_o_ai 10959 vec_vsr(vector bool int __a, vector unsigned int __b) { 10960 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10961 (vector int)__b); 10962 } 10963 10964 /* vec_sro */ 10965 10966 static __inline__ vector signed char __ATTRS_o_ai 10967 vec_sro(vector signed char __a, vector signed char __b) { 10968 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10969 (vector int)__b); 10970 } 10971 10972 static __inline__ vector signed char __ATTRS_o_ai 10973 vec_sro(vector signed char __a, vector unsigned char __b) { 10974 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10975 (vector int)__b); 10976 } 10977 10978 static __inline__ vector unsigned char __ATTRS_o_ai 10979 vec_sro(vector unsigned char __a, vector signed char __b) { 10980 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10981 (vector int)__b); 10982 } 10983 10984 static __inline__ vector unsigned char __ATTRS_o_ai 10985 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10986 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10987 (vector int)__b); 10988 } 10989 10990 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10991 vector signed char __b) { 10992 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10993 } 10994 10995 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10996 vector unsigned char __b) { 10997 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10998 } 10999 11000 static __inline__ vector unsigned short __ATTRS_o_ai 11001 vec_sro(vector unsigned short __a, vector signed char __b) { 11002 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11003 (vector int)__b); 11004 } 11005 11006 static __inline__ vector unsigned short __ATTRS_o_ai 11007 vec_sro(vector unsigned short __a, vector unsigned char __b) { 11008 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11009 (vector int)__b); 11010 } 11011 11012 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 11013 vector signed char __b) { 11014 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11015 } 11016 11017 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 11018 vector unsigned char __b) { 11019 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11020 } 11021 11022 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 11023 vector signed char __b) { 11024 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11025 } 11026 11027 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 11028 vector unsigned char __b) { 11029 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11030 } 11031 11032 static __inline__ vector unsigned int __ATTRS_o_ai 11033 vec_sro(vector unsigned int __a, vector signed char __b) { 11034 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11035 (vector int)__b); 11036 } 11037 11038 static __inline__ vector unsigned int __ATTRS_o_ai 11039 vec_sro(vector unsigned int __a, vector unsigned char __b) { 11040 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11041 (vector int)__b); 11042 } 11043 11044 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 11045 vector signed char __b) { 11046 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11047 } 11048 11049 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 11050 vector unsigned char __b) { 11051 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11052 } 11053 11054 #ifdef __VSX__ 11055 static __inline__ vector signed long long __ATTRS_o_ai 11056 vec_sro(vector signed long long __a, vector signed char __b) { 11057 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 11058 (vector int)__b); 11059 } 11060 11061 static __inline__ vector signed long long __ATTRS_o_ai 11062 vec_sro(vector signed long long __a, vector unsigned char __b) { 11063 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 11064 (vector int)__b); 11065 } 11066 11067 static __inline__ vector unsigned long long __ATTRS_o_ai 11068 vec_sro(vector unsigned long long __a, vector signed char __b) { 11069 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11070 (vector int)__b); 11071 } 11072 11073 static __inline__ vector unsigned long long __ATTRS_o_ai 11074 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 11075 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11076 (vector int)__b); 11077 } 11078 #endif 11079 11080 /* vec_vsro */ 11081 11082 static __inline__ vector signed char __ATTRS_o_ai 11083 vec_vsro(vector signed char __a, vector signed char __b) { 11084 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11085 (vector int)__b); 11086 } 11087 11088 static __inline__ vector signed char __ATTRS_o_ai 11089 vec_vsro(vector signed char __a, vector unsigned char __b) { 11090 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11091 (vector int)__b); 11092 } 11093 11094 static __inline__ vector unsigned char __ATTRS_o_ai 11095 vec_vsro(vector unsigned char __a, vector signed char __b) { 11096 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11097 (vector int)__b); 11098 } 11099 11100 static __inline__ vector unsigned char __ATTRS_o_ai 11101 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 11102 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11103 (vector int)__b); 11104 } 11105 11106 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11107 vector signed char __b) { 11108 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11109 } 11110 11111 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11112 vector unsigned char __b) { 11113 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11114 } 11115 11116 static __inline__ vector unsigned short __ATTRS_o_ai 11117 vec_vsro(vector unsigned short __a, vector signed char __b) { 11118 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11119 (vector int)__b); 11120 } 11121 11122 static __inline__ vector unsigned short __ATTRS_o_ai 11123 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 11124 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11125 (vector int)__b); 11126 } 11127 11128 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11129 vector signed char __b) { 11130 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11131 } 11132 11133 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11134 vector unsigned char __b) { 11135 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11136 } 11137 11138 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11139 vector signed char __b) { 11140 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11141 } 11142 11143 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11144 vector unsigned char __b) { 11145 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11146 } 11147 11148 static __inline__ vector unsigned int __ATTRS_o_ai 11149 vec_vsro(vector unsigned int __a, vector signed char __b) { 11150 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11151 (vector int)__b); 11152 } 11153 11154 static __inline__ vector unsigned int __ATTRS_o_ai 11155 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 11156 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11157 (vector int)__b); 11158 } 11159 11160 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11161 vector signed char __b) { 11162 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11163 } 11164 11165 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11166 vector unsigned char __b) { 11167 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11168 } 11169 11170 /* vec_st */ 11171 11172 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11173 vector signed char *__c) { 11174 __builtin_altivec_stvx((vector int)__a, __b, __c); 11175 } 11176 11177 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11178 signed char *__c) { 11179 __builtin_altivec_stvx((vector int)__a, __b, __c); 11180 } 11181 11182 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11183 vector unsigned char *__c) { 11184 __builtin_altivec_stvx((vector int)__a, __b, __c); 11185 } 11186 11187 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11188 unsigned char *__c) { 11189 __builtin_altivec_stvx((vector int)__a, __b, __c); 11190 } 11191 11192 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11193 signed char *__c) { 11194 __builtin_altivec_stvx((vector int)__a, __b, __c); 11195 } 11196 11197 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11198 unsigned char *__c) { 11199 __builtin_altivec_stvx((vector int)__a, __b, __c); 11200 } 11201 11202 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11203 vector bool char *__c) { 11204 __builtin_altivec_stvx((vector int)__a, __b, __c); 11205 } 11206 11207 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11208 vector short *__c) { 11209 __builtin_altivec_stvx((vector int)__a, __b, __c); 11210 } 11211 11212 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11213 short *__c) { 11214 __builtin_altivec_stvx((vector int)__a, __b, __c); 11215 } 11216 11217 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11218 vector unsigned short *__c) { 11219 __builtin_altivec_stvx((vector int)__a, __b, __c); 11220 } 11221 11222 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11223 unsigned short *__c) { 11224 __builtin_altivec_stvx((vector int)__a, __b, __c); 11225 } 11226 11227 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11228 short *__c) { 11229 __builtin_altivec_stvx((vector int)__a, __b, __c); 11230 } 11231 11232 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11233 unsigned short *__c) { 11234 __builtin_altivec_stvx((vector int)__a, __b, __c); 11235 } 11236 11237 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11238 vector bool short *__c) { 11239 __builtin_altivec_stvx((vector int)__a, __b, __c); 11240 } 11241 11242 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11243 short *__c) { 11244 __builtin_altivec_stvx((vector int)__a, __b, __c); 11245 } 11246 11247 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11248 unsigned short *__c) { 11249 __builtin_altivec_stvx((vector int)__a, __b, __c); 11250 } 11251 11252 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11253 vector pixel *__c) { 11254 __builtin_altivec_stvx((vector int)__a, __b, __c); 11255 } 11256 11257 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, 11258 vector int *__c) { 11259 __builtin_altivec_stvx(__a, __b, __c); 11260 } 11261 11262 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) { 11263 __builtin_altivec_stvx(__a, __b, __c); 11264 } 11265 11266 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11267 vector unsigned int *__c) { 11268 __builtin_altivec_stvx((vector int)__a, __b, __c); 11269 } 11270 11271 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11272 unsigned int *__c) { 11273 __builtin_altivec_stvx((vector int)__a, __b, __c); 11274 } 11275 11276 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11277 int *__c) { 11278 __builtin_altivec_stvx((vector int)__a, __b, __c); 11279 } 11280 11281 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11282 unsigned int *__c) { 11283 __builtin_altivec_stvx((vector int)__a, __b, __c); 11284 } 11285 11286 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11287 vector bool int *__c) { 11288 __builtin_altivec_stvx((vector int)__a, __b, __c); 11289 } 11290 11291 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11292 vector float *__c) { 11293 __builtin_altivec_stvx((vector int)__a, __b, __c); 11294 } 11295 11296 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11297 float *__c) { 11298 __builtin_altivec_stvx((vector int)__a, __b, __c); 11299 } 11300 11301 /* vec_stvx */ 11302 11303 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11304 vector signed char *__c) { 11305 __builtin_altivec_stvx((vector int)__a, __b, __c); 11306 } 11307 11308 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11309 signed char *__c) { 11310 __builtin_altivec_stvx((vector int)__a, __b, __c); 11311 } 11312 11313 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11314 vector unsigned char *__c) { 11315 __builtin_altivec_stvx((vector int)__a, __b, __c); 11316 } 11317 11318 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11319 unsigned char *__c) { 11320 __builtin_altivec_stvx((vector int)__a, __b, __c); 11321 } 11322 11323 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11324 signed char *__c) { 11325 __builtin_altivec_stvx((vector int)__a, __b, __c); 11326 } 11327 11328 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11329 unsigned char *__c) { 11330 __builtin_altivec_stvx((vector int)__a, __b, __c); 11331 } 11332 11333 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11334 vector bool char *__c) { 11335 __builtin_altivec_stvx((vector int)__a, __b, __c); 11336 } 11337 11338 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11339 vector short *__c) { 11340 __builtin_altivec_stvx((vector int)__a, __b, __c); 11341 } 11342 11343 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11344 short *__c) { 11345 __builtin_altivec_stvx((vector int)__a, __b, __c); 11346 } 11347 11348 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11349 vector unsigned short *__c) { 11350 __builtin_altivec_stvx((vector int)__a, __b, __c); 11351 } 11352 11353 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11354 unsigned short *__c) { 11355 __builtin_altivec_stvx((vector int)__a, __b, __c); 11356 } 11357 11358 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11359 short *__c) { 11360 __builtin_altivec_stvx((vector int)__a, __b, __c); 11361 } 11362 11363 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11364 unsigned short *__c) { 11365 __builtin_altivec_stvx((vector int)__a, __b, __c); 11366 } 11367 11368 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11369 vector bool short *__c) { 11370 __builtin_altivec_stvx((vector int)__a, __b, __c); 11371 } 11372 11373 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11374 short *__c) { 11375 __builtin_altivec_stvx((vector int)__a, __b, __c); 11376 } 11377 11378 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11379 unsigned short *__c) { 11380 __builtin_altivec_stvx((vector int)__a, __b, __c); 11381 } 11382 11383 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11384 vector pixel *__c) { 11385 __builtin_altivec_stvx((vector int)__a, __b, __c); 11386 } 11387 11388 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11389 vector int *__c) { 11390 __builtin_altivec_stvx(__a, __b, __c); 11391 } 11392 11393 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11394 int *__c) { 11395 __builtin_altivec_stvx(__a, __b, __c); 11396 } 11397 11398 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11399 vector unsigned int *__c) { 11400 __builtin_altivec_stvx((vector int)__a, __b, __c); 11401 } 11402 11403 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11404 unsigned int *__c) { 11405 __builtin_altivec_stvx((vector int)__a, __b, __c); 11406 } 11407 11408 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11409 int *__c) { 11410 __builtin_altivec_stvx((vector int)__a, __b, __c); 11411 } 11412 11413 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11414 unsigned int *__c) { 11415 __builtin_altivec_stvx((vector int)__a, __b, __c); 11416 } 11417 11418 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11419 vector bool int *__c) { 11420 __builtin_altivec_stvx((vector int)__a, __b, __c); 11421 } 11422 11423 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11424 vector float *__c) { 11425 __builtin_altivec_stvx((vector int)__a, __b, __c); 11426 } 11427 11428 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11429 float *__c) { 11430 __builtin_altivec_stvx((vector int)__a, __b, __c); 11431 } 11432 11433 /* vec_ste */ 11434 11435 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, 11436 signed char *__c) { 11437 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11438 } 11439 11440 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b, 11441 unsigned char *__c) { 11442 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11443 } 11444 11445 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11446 signed char *__c) { 11447 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11448 } 11449 11450 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11451 unsigned char *__c) { 11452 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11453 } 11454 11455 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b, 11456 short *__c) { 11457 __builtin_altivec_stvehx(__a, __b, __c); 11458 } 11459 11460 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b, 11461 unsigned short *__c) { 11462 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11463 } 11464 11465 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11466 short *__c) { 11467 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11468 } 11469 11470 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11471 unsigned short *__c) { 11472 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11473 } 11474 11475 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11476 short *__c) { 11477 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11478 } 11479 11480 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11481 unsigned short *__c) { 11482 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11483 } 11484 11485 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) { 11486 __builtin_altivec_stvewx(__a, __b, __c); 11487 } 11488 11489 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b, 11490 unsigned int *__c) { 11491 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11492 } 11493 11494 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11495 int *__c) { 11496 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11497 } 11498 11499 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11500 unsigned int *__c) { 11501 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11502 } 11503 11504 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b, 11505 float *__c) { 11506 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11507 } 11508 11509 /* vec_stvebx */ 11510 11511 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, 11512 signed char *__c) { 11513 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11514 } 11515 11516 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 11517 long __b, unsigned char *__c) { 11518 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11519 } 11520 11521 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11522 signed char *__c) { 11523 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11524 } 11525 11526 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11527 unsigned char *__c) { 11528 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11529 } 11530 11531 /* vec_stvehx */ 11532 11533 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, 11534 short *__c) { 11535 __builtin_altivec_stvehx(__a, __b, __c); 11536 } 11537 11538 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 11539 long __b, unsigned short *__c) { 11540 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11541 } 11542 11543 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11544 short *__c) { 11545 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11546 } 11547 11548 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11549 unsigned short *__c) { 11550 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11551 } 11552 11553 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11554 short *__c) { 11555 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11556 } 11557 11558 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11559 unsigned short *__c) { 11560 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11561 } 11562 11563 /* vec_stvewx */ 11564 11565 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, 11566 int *__c) { 11567 __builtin_altivec_stvewx(__a, __b, __c); 11568 } 11569 11570 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b, 11571 unsigned int *__c) { 11572 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11573 } 11574 11575 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11576 int *__c) { 11577 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11578 } 11579 11580 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11581 unsigned int *__c) { 11582 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11583 } 11584 11585 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b, 11586 float *__c) { 11587 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11588 } 11589 11590 /* vec_stl */ 11591 11592 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11593 vector signed char *__c) { 11594 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11595 } 11596 11597 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11598 signed char *__c) { 11599 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11600 } 11601 11602 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11603 vector unsigned char *__c) { 11604 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11605 } 11606 11607 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11608 unsigned char *__c) { 11609 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11610 } 11611 11612 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11613 signed char *__c) { 11614 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11615 } 11616 11617 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11618 unsigned char *__c) { 11619 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11620 } 11621 11622 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11623 vector bool char *__c) { 11624 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11625 } 11626 11627 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11628 vector short *__c) { 11629 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11630 } 11631 11632 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11633 short *__c) { 11634 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11635 } 11636 11637 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11638 vector unsigned short *__c) { 11639 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11640 } 11641 11642 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11643 unsigned short *__c) { 11644 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11645 } 11646 11647 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11648 short *__c) { 11649 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11650 } 11651 11652 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11653 unsigned short *__c) { 11654 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11655 } 11656 11657 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11658 vector bool short *__c) { 11659 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11660 } 11661 11662 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11663 short *__c) { 11664 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11665 } 11666 11667 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11668 unsigned short *__c) { 11669 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11670 } 11671 11672 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11673 vector pixel *__c) { 11674 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11675 } 11676 11677 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 11678 vector int *__c) { 11679 __builtin_altivec_stvxl(__a, __b, __c); 11680 } 11681 11682 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 11683 __builtin_altivec_stvxl(__a, __b, __c); 11684 } 11685 11686 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11687 vector unsigned int *__c) { 11688 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11689 } 11690 11691 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11692 unsigned int *__c) { 11693 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11694 } 11695 11696 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11697 int *__c) { 11698 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11699 } 11700 11701 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11702 unsigned int *__c) { 11703 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11704 } 11705 11706 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11707 vector bool int *__c) { 11708 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11709 } 11710 11711 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11712 vector float *__c) { 11713 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11714 } 11715 11716 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11717 float *__c) { 11718 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11719 } 11720 11721 /* vec_stvxl */ 11722 11723 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11724 vector signed char *__c) { 11725 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11726 } 11727 11728 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11729 signed char *__c) { 11730 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11731 } 11732 11733 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11734 vector unsigned char *__c) { 11735 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11736 } 11737 11738 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11739 unsigned char *__c) { 11740 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11741 } 11742 11743 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11744 signed char *__c) { 11745 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11746 } 11747 11748 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11749 unsigned char *__c) { 11750 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11751 } 11752 11753 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11754 vector bool char *__c) { 11755 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11756 } 11757 11758 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11759 vector short *__c) { 11760 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11761 } 11762 11763 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11764 short *__c) { 11765 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11766 } 11767 11768 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11769 int __b, 11770 vector unsigned short *__c) { 11771 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11772 } 11773 11774 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11775 int __b, unsigned short *__c) { 11776 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11777 } 11778 11779 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11780 short *__c) { 11781 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11782 } 11783 11784 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11785 unsigned short *__c) { 11786 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11787 } 11788 11789 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11790 vector bool short *__c) { 11791 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11792 } 11793 11794 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11795 short *__c) { 11796 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11797 } 11798 11799 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11800 unsigned short *__c) { 11801 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11802 } 11803 11804 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11805 vector pixel *__c) { 11806 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11807 } 11808 11809 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11810 vector int *__c) { 11811 __builtin_altivec_stvxl(__a, __b, __c); 11812 } 11813 11814 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11815 int *__c) { 11816 __builtin_altivec_stvxl(__a, __b, __c); 11817 } 11818 11819 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11820 vector unsigned int *__c) { 11821 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11822 } 11823 11824 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11825 unsigned int *__c) { 11826 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11827 } 11828 11829 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11830 int *__c) { 11831 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11832 } 11833 11834 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11835 unsigned int *__c) { 11836 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11837 } 11838 11839 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11840 vector bool int *__c) { 11841 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11842 } 11843 11844 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11845 vector float *__c) { 11846 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11847 } 11848 11849 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11850 float *__c) { 11851 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11852 } 11853 11854 /* vec_sub */ 11855 11856 static __inline__ vector signed char __ATTRS_o_ai 11857 vec_sub(vector signed char __a, vector signed char __b) { 11858 return __a - __b; 11859 } 11860 11861 static __inline__ vector signed char __ATTRS_o_ai 11862 vec_sub(vector bool char __a, vector signed char __b) { 11863 return (vector signed char)__a - __b; 11864 } 11865 11866 static __inline__ vector signed char __ATTRS_o_ai 11867 vec_sub(vector signed char __a, vector bool char __b) { 11868 return __a - (vector signed char)__b; 11869 } 11870 11871 static __inline__ vector unsigned char __ATTRS_o_ai 11872 vec_sub(vector unsigned char __a, vector unsigned char __b) { 11873 return __a - __b; 11874 } 11875 11876 static __inline__ vector unsigned char __ATTRS_o_ai 11877 vec_sub(vector bool char __a, vector unsigned char __b) { 11878 return (vector unsigned char)__a - __b; 11879 } 11880 11881 static __inline__ vector unsigned char __ATTRS_o_ai 11882 vec_sub(vector unsigned char __a, vector bool char __b) { 11883 return __a - (vector unsigned char)__b; 11884 } 11885 11886 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11887 vector short __b) { 11888 return __a - __b; 11889 } 11890 11891 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 11892 vector short __b) { 11893 return (vector short)__a - __b; 11894 } 11895 11896 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11897 vector bool short __b) { 11898 return __a - (vector short)__b; 11899 } 11900 11901 static __inline__ vector unsigned short __ATTRS_o_ai 11902 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11903 return __a - __b; 11904 } 11905 11906 static __inline__ vector unsigned short __ATTRS_o_ai 11907 vec_sub(vector bool short __a, vector unsigned short __b) { 11908 return (vector unsigned short)__a - __b; 11909 } 11910 11911 static __inline__ vector unsigned short __ATTRS_o_ai 11912 vec_sub(vector unsigned short __a, vector bool short __b) { 11913 return __a - (vector unsigned short)__b; 11914 } 11915 11916 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11917 vector int __b) { 11918 return __a - __b; 11919 } 11920 11921 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11922 vector int __b) { 11923 return (vector int)__a - __b; 11924 } 11925 11926 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11927 vector bool int __b) { 11928 return __a - (vector int)__b; 11929 } 11930 11931 static __inline__ vector unsigned int __ATTRS_o_ai 11932 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11933 return __a - __b; 11934 } 11935 11936 static __inline__ vector unsigned int __ATTRS_o_ai 11937 vec_sub(vector bool int __a, vector unsigned int __b) { 11938 return (vector unsigned int)__a - __b; 11939 } 11940 11941 static __inline__ vector unsigned int __ATTRS_o_ai 11942 vec_sub(vector unsigned int __a, vector bool int __b) { 11943 return __a - (vector unsigned int)__b; 11944 } 11945 11946 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 11947 defined(__SIZEOF_INT128__) 11948 static __inline__ vector signed __int128 __ATTRS_o_ai 11949 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11950 return __a - __b; 11951 } 11952 11953 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11954 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11955 return __a - __b; 11956 } 11957 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) && 11958 // defined(__SIZEOF_INT128__) 11959 11960 #ifdef __VSX__ 11961 static __inline__ vector signed long long __ATTRS_o_ai 11962 vec_sub(vector signed long long __a, vector signed long long __b) { 11963 return __a - __b; 11964 } 11965 11966 static __inline__ vector unsigned long long __ATTRS_o_ai 11967 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11968 return __a - __b; 11969 } 11970 11971 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11972 vector double __b) { 11973 return __a - __b; 11974 } 11975 #endif 11976 11977 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11978 vector float __b) { 11979 return __a - __b; 11980 } 11981 11982 /* vec_vsububm */ 11983 11984 #define __builtin_altivec_vsububm vec_vsububm 11985 11986 static __inline__ vector signed char __ATTRS_o_ai 11987 vec_vsububm(vector signed char __a, vector signed char __b) { 11988 return __a - __b; 11989 } 11990 11991 static __inline__ vector signed char __ATTRS_o_ai 11992 vec_vsububm(vector bool char __a, vector signed char __b) { 11993 return (vector signed char)__a - __b; 11994 } 11995 11996 static __inline__ vector signed char __ATTRS_o_ai 11997 vec_vsububm(vector signed char __a, vector bool char __b) { 11998 return __a - (vector signed char)__b; 11999 } 12000 12001 static __inline__ vector unsigned char __ATTRS_o_ai 12002 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 12003 return __a - __b; 12004 } 12005 12006 static __inline__ vector unsigned char __ATTRS_o_ai 12007 vec_vsububm(vector bool char __a, vector unsigned char __b) { 12008 return (vector unsigned char)__a - __b; 12009 } 12010 12011 static __inline__ vector unsigned char __ATTRS_o_ai 12012 vec_vsububm(vector unsigned char __a, vector bool char __b) { 12013 return __a - (vector unsigned char)__b; 12014 } 12015 12016 /* vec_vsubuhm */ 12017 12018 #define __builtin_altivec_vsubuhm vec_vsubuhm 12019 12020 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 12021 vector short __b) { 12022 return __a - __b; 12023 } 12024 12025 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 12026 vector short __b) { 12027 return (vector short)__a - __b; 12028 } 12029 12030 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 12031 vector bool short __b) { 12032 return __a - (vector short)__b; 12033 } 12034 12035 static __inline__ vector unsigned short __ATTRS_o_ai 12036 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 12037 return __a - __b; 12038 } 12039 12040 static __inline__ vector unsigned short __ATTRS_o_ai 12041 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 12042 return (vector unsigned short)__a - __b; 12043 } 12044 12045 static __inline__ vector unsigned short __ATTRS_o_ai 12046 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 12047 return __a - (vector unsigned short)__b; 12048 } 12049 12050 /* vec_vsubuwm */ 12051 12052 #define __builtin_altivec_vsubuwm vec_vsubuwm 12053 12054 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 12055 vector int __b) { 12056 return __a - __b; 12057 } 12058 12059 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 12060 vector int __b) { 12061 return (vector int)__a - __b; 12062 } 12063 12064 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 12065 vector bool int __b) { 12066 return __a - (vector int)__b; 12067 } 12068 12069 static __inline__ vector unsigned int __ATTRS_o_ai 12070 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 12071 return __a - __b; 12072 } 12073 12074 static __inline__ vector unsigned int __ATTRS_o_ai 12075 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 12076 return (vector unsigned int)__a - __b; 12077 } 12078 12079 static __inline__ vector unsigned int __ATTRS_o_ai 12080 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 12081 return __a - (vector unsigned int)__b; 12082 } 12083 12084 /* vec_vsubfp */ 12085 12086 #define __builtin_altivec_vsubfp vec_vsubfp 12087 12088 static __inline__ vector float __attribute__((__always_inline__)) 12089 vec_vsubfp(vector float __a, vector float __b) { 12090 return __a - __b; 12091 } 12092 12093 /* vec_subc */ 12094 12095 static __inline__ vector signed int __ATTRS_o_ai 12096 vec_subc(vector signed int __a, vector signed int __b) { 12097 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 12098 (vector unsigned int) __b); 12099 } 12100 12101 static __inline__ vector unsigned int __ATTRS_o_ai 12102 vec_subc(vector unsigned int __a, vector unsigned int __b) { 12103 return __builtin_altivec_vsubcuw(__a, __b); 12104 } 12105 12106 #ifdef __POWER8_VECTOR__ 12107 #ifdef __SIZEOF_INT128__ 12108 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12109 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12110 return __builtin_altivec_vsubcuq(__a, __b); 12111 } 12112 12113 static __inline__ vector signed __int128 __ATTRS_o_ai 12114 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 12115 return (vector signed __int128)__builtin_altivec_vsubcuq( 12116 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 12117 } 12118 #endif 12119 12120 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12121 vec_subc_u128(vector unsigned char __a, vector unsigned char __b) { 12122 return (vector unsigned char)__builtin_altivec_vsubcuq_c( 12123 (vector unsigned char)__a, (vector unsigned char)__b); 12124 } 12125 #endif // __POWER8_VECTOR__ 12126 12127 /* vec_vsubcuw */ 12128 12129 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12130 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 12131 return __builtin_altivec_vsubcuw(__a, __b); 12132 } 12133 12134 /* vec_subs */ 12135 12136 static __inline__ vector signed char __ATTRS_o_ai 12137 vec_subs(vector signed char __a, vector signed char __b) { 12138 return __builtin_altivec_vsubsbs(__a, __b); 12139 } 12140 12141 static __inline__ vector signed char __ATTRS_o_ai 12142 vec_subs(vector bool char __a, vector signed char __b) { 12143 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12144 } 12145 12146 static __inline__ vector signed char __ATTRS_o_ai 12147 vec_subs(vector signed char __a, vector bool char __b) { 12148 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12149 } 12150 12151 static __inline__ vector unsigned char __ATTRS_o_ai 12152 vec_subs(vector unsigned char __a, vector unsigned char __b) { 12153 return __builtin_altivec_vsububs(__a, __b); 12154 } 12155 12156 static __inline__ vector unsigned char __ATTRS_o_ai 12157 vec_subs(vector bool char __a, vector unsigned char __b) { 12158 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12159 } 12160 12161 static __inline__ vector unsigned char __ATTRS_o_ai 12162 vec_subs(vector unsigned char __a, vector bool char __b) { 12163 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12164 } 12165 12166 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12167 vector short __b) { 12168 return __builtin_altivec_vsubshs(__a, __b); 12169 } 12170 12171 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 12172 vector short __b) { 12173 return __builtin_altivec_vsubshs((vector short)__a, __b); 12174 } 12175 12176 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12177 vector bool short __b) { 12178 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12179 } 12180 12181 static __inline__ vector unsigned short __ATTRS_o_ai 12182 vec_subs(vector unsigned short __a, vector unsigned short __b) { 12183 return __builtin_altivec_vsubuhs(__a, __b); 12184 } 12185 12186 static __inline__ vector unsigned short __ATTRS_o_ai 12187 vec_subs(vector bool short __a, vector unsigned short __b) { 12188 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12189 } 12190 12191 static __inline__ vector unsigned short __ATTRS_o_ai 12192 vec_subs(vector unsigned short __a, vector bool short __b) { 12193 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12194 } 12195 12196 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12197 vector int __b) { 12198 return __builtin_altivec_vsubsws(__a, __b); 12199 } 12200 12201 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 12202 vector int __b) { 12203 return __builtin_altivec_vsubsws((vector int)__a, __b); 12204 } 12205 12206 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12207 vector bool int __b) { 12208 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12209 } 12210 12211 static __inline__ vector unsigned int __ATTRS_o_ai 12212 vec_subs(vector unsigned int __a, vector unsigned int __b) { 12213 return __builtin_altivec_vsubuws(__a, __b); 12214 } 12215 12216 static __inline__ vector unsigned int __ATTRS_o_ai 12217 vec_subs(vector bool int __a, vector unsigned int __b) { 12218 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12219 } 12220 12221 static __inline__ vector unsigned int __ATTRS_o_ai 12222 vec_subs(vector unsigned int __a, vector bool int __b) { 12223 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12224 } 12225 12226 /* vec_vsubsbs */ 12227 12228 static __inline__ vector signed char __ATTRS_o_ai 12229 vec_vsubsbs(vector signed char __a, vector signed char __b) { 12230 return __builtin_altivec_vsubsbs(__a, __b); 12231 } 12232 12233 static __inline__ vector signed char __ATTRS_o_ai 12234 vec_vsubsbs(vector bool char __a, vector signed char __b) { 12235 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12236 } 12237 12238 static __inline__ vector signed char __ATTRS_o_ai 12239 vec_vsubsbs(vector signed char __a, vector bool char __b) { 12240 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12241 } 12242 12243 /* vec_vsububs */ 12244 12245 static __inline__ vector unsigned char __ATTRS_o_ai 12246 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 12247 return __builtin_altivec_vsububs(__a, __b); 12248 } 12249 12250 static __inline__ vector unsigned char __ATTRS_o_ai 12251 vec_vsububs(vector bool char __a, vector unsigned char __b) { 12252 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12253 } 12254 12255 static __inline__ vector unsigned char __ATTRS_o_ai 12256 vec_vsububs(vector unsigned char __a, vector bool char __b) { 12257 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12258 } 12259 12260 /* vec_vsubshs */ 12261 12262 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12263 vector short __b) { 12264 return __builtin_altivec_vsubshs(__a, __b); 12265 } 12266 12267 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 12268 vector short __b) { 12269 return __builtin_altivec_vsubshs((vector short)__a, __b); 12270 } 12271 12272 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12273 vector bool short __b) { 12274 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12275 } 12276 12277 /* vec_vsubuhs */ 12278 12279 static __inline__ vector unsigned short __ATTRS_o_ai 12280 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 12281 return __builtin_altivec_vsubuhs(__a, __b); 12282 } 12283 12284 static __inline__ vector unsigned short __ATTRS_o_ai 12285 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 12286 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12287 } 12288 12289 static __inline__ vector unsigned short __ATTRS_o_ai 12290 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 12291 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12292 } 12293 12294 /* vec_vsubsws */ 12295 12296 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12297 vector int __b) { 12298 return __builtin_altivec_vsubsws(__a, __b); 12299 } 12300 12301 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 12302 vector int __b) { 12303 return __builtin_altivec_vsubsws((vector int)__a, __b); 12304 } 12305 12306 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12307 vector bool int __b) { 12308 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12309 } 12310 12311 /* vec_vsubuws */ 12312 12313 static __inline__ vector unsigned int __ATTRS_o_ai 12314 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 12315 return __builtin_altivec_vsubuws(__a, __b); 12316 } 12317 12318 static __inline__ vector unsigned int __ATTRS_o_ai 12319 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 12320 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12321 } 12322 12323 static __inline__ vector unsigned int __ATTRS_o_ai 12324 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 12325 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12326 } 12327 12328 #ifdef __POWER8_VECTOR__ 12329 /* vec_vsubuqm */ 12330 12331 #ifdef __SIZEOF_INT128__ 12332 static __inline__ vector signed __int128 __ATTRS_o_ai 12333 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 12334 return __a - __b; 12335 } 12336 12337 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12338 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12339 return __a - __b; 12340 } 12341 #endif 12342 12343 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12344 vec_sub_u128(vector unsigned char __a, vector unsigned char __b) { 12345 return (vector unsigned char)__builtin_altivec_vsubuqm(__a, __b); 12346 } 12347 12348 /* vec_vsubeuqm */ 12349 12350 #ifdef __SIZEOF_INT128__ 12351 static __inline__ vector signed __int128 __ATTRS_o_ai 12352 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 12353 vector signed __int128 __c) { 12354 return (vector signed __int128)__builtin_altivec_vsubeuqm( 12355 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 12356 (vector unsigned __int128)__c); 12357 } 12358 12359 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12360 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 12361 vector unsigned __int128 __c) { 12362 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12363 } 12364 12365 static __inline__ vector signed __int128 __ATTRS_o_ai 12366 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 12367 vector signed __int128 __c) { 12368 return (vector signed __int128)__builtin_altivec_vsubeuqm( 12369 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 12370 (vector unsigned __int128)__c); 12371 } 12372 12373 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12374 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 12375 vector unsigned __int128 __c) { 12376 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12377 } 12378 #endif 12379 12380 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12381 vec_sube_u128(vector unsigned char __a, vector unsigned char __b, 12382 vector unsigned char __c) { 12383 return (vector unsigned char)__builtin_altivec_vsubeuqm_c( 12384 (vector unsigned char)__a, (vector unsigned char)__b, 12385 (vector unsigned char)__c); 12386 } 12387 12388 /* vec_vsubcuq */ 12389 12390 #ifdef __SIZEOF_INT128__ 12391 static __inline__ vector signed __int128 __ATTRS_o_ai 12392 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 12393 return (vector signed __int128)__builtin_altivec_vsubcuq( 12394 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 12395 } 12396 12397 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12398 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12399 return __builtin_altivec_vsubcuq(__a, __b); 12400 } 12401 12402 /* vec_vsubecuq */ 12403 12404 static __inline__ vector signed __int128 __ATTRS_o_ai 12405 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 12406 vector signed __int128 __c) { 12407 return (vector signed __int128)__builtin_altivec_vsubecuq( 12408 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 12409 (vector unsigned __int128)__c); 12410 } 12411 12412 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12413 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 12414 vector unsigned __int128 __c) { 12415 return __builtin_altivec_vsubecuq(__a, __b, __c); 12416 } 12417 #endif 12418 12419 #ifdef __powerpc64__ 12420 static __inline__ vector signed int __ATTRS_o_ai 12421 vec_subec(vector signed int __a, vector signed int __b, 12422 vector signed int __c) { 12423 return vec_addec(__a, ~__b, __c); 12424 } 12425 12426 static __inline__ vector unsigned int __ATTRS_o_ai 12427 vec_subec(vector unsigned int __a, vector unsigned int __b, 12428 vector unsigned int __c) { 12429 return vec_addec(__a, ~__b, __c); 12430 } 12431 #endif 12432 12433 #ifdef __SIZEOF_INT128__ 12434 static __inline__ vector signed __int128 __ATTRS_o_ai 12435 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 12436 vector signed __int128 __c) { 12437 return (vector signed __int128)__builtin_altivec_vsubecuq( 12438 (vector unsigned __int128)__a, (vector unsigned __int128)__b, 12439 (vector unsigned __int128)__c); 12440 } 12441 12442 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12443 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 12444 vector unsigned __int128 __c) { 12445 return __builtin_altivec_vsubecuq(__a, __b, __c); 12446 } 12447 #endif 12448 12449 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12450 vec_subec_u128(vector unsigned char __a, vector unsigned char __b, 12451 vector unsigned char __c) { 12452 return (vector unsigned char)__builtin_altivec_vsubecuq_c( 12453 (vector unsigned char)__a, (vector unsigned char)__b, 12454 (vector unsigned char)__c); 12455 } 12456 #endif // __POWER8_VECTOR__ 12457 12458 static __inline__ vector signed int __ATTRS_o_ai 12459 vec_sube(vector signed int __a, vector signed int __b, 12460 vector signed int __c) { 12461 vector signed int __mask = {1, 1, 1, 1}; 12462 vector signed int __carry = __c & __mask; 12463 return vec_adde(__a, ~__b, __carry); 12464 } 12465 12466 static __inline__ vector unsigned int __ATTRS_o_ai 12467 vec_sube(vector unsigned int __a, vector unsigned int __b, 12468 vector unsigned int __c) { 12469 vector unsigned int __mask = {1, 1, 1, 1}; 12470 vector unsigned int __carry = __c & __mask; 12471 return vec_adde(__a, ~__b, __carry); 12472 } 12473 /* vec_sum4s */ 12474 12475 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 12476 vector int __b) { 12477 return __builtin_altivec_vsum4sbs(__a, __b); 12478 } 12479 12480 static __inline__ vector unsigned int __ATTRS_o_ai 12481 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 12482 return __builtin_altivec_vsum4ubs(__a, __b); 12483 } 12484 12485 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 12486 vector int __b) { 12487 return __builtin_altivec_vsum4shs(__a, __b); 12488 } 12489 12490 /* vec_vsum4sbs */ 12491 12492 static __inline__ vector int __attribute__((__always_inline__)) 12493 vec_vsum4sbs(vector signed char __a, vector int __b) { 12494 return __builtin_altivec_vsum4sbs(__a, __b); 12495 } 12496 12497 /* vec_vsum4ubs */ 12498 12499 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12500 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 12501 return __builtin_altivec_vsum4ubs(__a, __b); 12502 } 12503 12504 /* vec_vsum4shs */ 12505 12506 static __inline__ vector int __attribute__((__always_inline__)) 12507 vec_vsum4shs(vector signed short __a, vector int __b) { 12508 return __builtin_altivec_vsum4shs(__a, __b); 12509 } 12510 12511 /* vec_sum2s */ 12512 12513 /* The vsum2sws instruction has a big-endian bias, so that the second 12514 input vector and the result always reference big-endian elements 12515 1 and 3 (little-endian element 0 and 2). For ease of porting the 12516 programmer wants elements 1 and 3 in both cases, so for little 12517 endian we must perform some permutes. */ 12518 12519 static __inline__ vector signed int __attribute__((__always_inline__)) 12520 vec_sum2s(vector int __a, vector int __b) { 12521 #ifdef __LITTLE_ENDIAN__ 12522 vector int __c = (vector signed int)vec_perm( 12523 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12524 8, 9, 10, 11)); 12525 __c = __builtin_altivec_vsum2sws(__a, __c); 12526 return (vector signed int)vec_perm( 12527 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12528 8, 9, 10, 11)); 12529 #else 12530 return __builtin_altivec_vsum2sws(__a, __b); 12531 #endif 12532 } 12533 12534 /* vec_vsum2sws */ 12535 12536 static __inline__ vector signed int __attribute__((__always_inline__)) 12537 vec_vsum2sws(vector int __a, vector int __b) { 12538 #ifdef __LITTLE_ENDIAN__ 12539 vector int __c = (vector signed int)vec_perm( 12540 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12541 8, 9, 10, 11)); 12542 __c = __builtin_altivec_vsum2sws(__a, __c); 12543 return (vector signed int)vec_perm( 12544 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12545 8, 9, 10, 11)); 12546 #else 12547 return __builtin_altivec_vsum2sws(__a, __b); 12548 #endif 12549 } 12550 12551 /* vec_sums */ 12552 12553 /* The vsumsws instruction has a big-endian bias, so that the second 12554 input vector and the result always reference big-endian element 3 12555 (little-endian element 0). For ease of porting the programmer 12556 wants element 3 in both cases, so for little endian we must perform 12557 some permutes. */ 12558 12559 static __inline__ vector signed int __attribute__((__always_inline__)) 12560 vec_sums(vector signed int __a, vector signed int __b) { 12561 #ifdef __LITTLE_ENDIAN__ 12562 __b = (vector signed int)vec_splat(__b, 3); 12563 __b = __builtin_altivec_vsumsws(__a, __b); 12564 return (vector signed int)(0, 0, 0, __b[0]); 12565 #else 12566 return __builtin_altivec_vsumsws(__a, __b); 12567 #endif 12568 } 12569 12570 /* vec_vsumsws */ 12571 12572 static __inline__ vector signed int __attribute__((__always_inline__)) 12573 vec_vsumsws(vector signed int __a, vector signed int __b) { 12574 #ifdef __LITTLE_ENDIAN__ 12575 __b = (vector signed int)vec_splat(__b, 3); 12576 __b = __builtin_altivec_vsumsws(__a, __b); 12577 return (vector signed int)(0, 0, 0, __b[0]); 12578 #else 12579 return __builtin_altivec_vsumsws(__a, __b); 12580 #endif 12581 } 12582 12583 /* vec_trunc */ 12584 12585 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 12586 #ifdef __VSX__ 12587 return __builtin_vsx_xvrspiz(__a); 12588 #else 12589 return __builtin_altivec_vrfiz(__a); 12590 #endif 12591 } 12592 12593 #ifdef __VSX__ 12594 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 12595 return __builtin_vsx_xvrdpiz(__a); 12596 } 12597 #endif 12598 12599 /* vec_roundz */ 12600 static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) { 12601 return vec_trunc(__a); 12602 } 12603 12604 #ifdef __VSX__ 12605 static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) { 12606 return vec_trunc(__a); 12607 } 12608 #endif 12609 12610 /* vec_vrfiz */ 12611 12612 static __inline__ vector float __attribute__((__always_inline__)) 12613 vec_vrfiz(vector float __a) { 12614 return __builtin_altivec_vrfiz(__a); 12615 } 12616 12617 /* vec_unpackh */ 12618 12619 /* The vector unpack instructions all have a big-endian bias, so for 12620 little endian we must reverse the meanings of "high" and "low." */ 12621 #ifdef __LITTLE_ENDIAN__ 12622 #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12623 #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12624 #else 12625 #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12626 #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12627 #endif 12628 12629 static __inline__ vector short __ATTRS_o_ai 12630 vec_unpackh(vector signed char __a) { 12631 #ifdef __LITTLE_ENDIAN__ 12632 return __builtin_altivec_vupklsb((vector char)__a); 12633 #else 12634 return __builtin_altivec_vupkhsb((vector char)__a); 12635 #endif 12636 } 12637 12638 static __inline__ vector bool short __ATTRS_o_ai 12639 vec_unpackh(vector bool char __a) { 12640 #ifdef __LITTLE_ENDIAN__ 12641 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12642 #else 12643 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12644 #endif 12645 } 12646 12647 static __inline__ vector int __ATTRS_o_ai vec_unpackh(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_unpackh(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_unpackh(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 #ifdef __POWER8_VECTOR__ 12674 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 12675 #ifdef __LITTLE_ENDIAN__ 12676 return __builtin_altivec_vupklsw(__a); 12677 #else 12678 return __builtin_altivec_vupkhsw(__a); 12679 #endif 12680 } 12681 12682 static __inline__ vector bool long long __ATTRS_o_ai 12683 vec_unpackh(vector bool int __a) { 12684 #ifdef __LITTLE_ENDIAN__ 12685 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12686 #else 12687 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12688 #endif 12689 } 12690 12691 static __inline__ vector double __ATTRS_o_ai 12692 vec_unpackh(vector float __a) { 12693 return (vector double)(__a[0], __a[1]); 12694 } 12695 #endif 12696 12697 /* vec_vupkhsb */ 12698 12699 static __inline__ vector short __ATTRS_o_ai 12700 vec_vupkhsb(vector signed char __a) { 12701 #ifdef __LITTLE_ENDIAN__ 12702 return __builtin_altivec_vupklsb((vector char)__a); 12703 #else 12704 return __builtin_altivec_vupkhsb((vector char)__a); 12705 #endif 12706 } 12707 12708 static __inline__ vector bool short __ATTRS_o_ai 12709 vec_vupkhsb(vector bool char __a) { 12710 #ifdef __LITTLE_ENDIAN__ 12711 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12712 #else 12713 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12714 #endif 12715 } 12716 12717 /* vec_vupkhsh */ 12718 12719 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 12720 #ifdef __LITTLE_ENDIAN__ 12721 return __builtin_altivec_vupklsh(__a); 12722 #else 12723 return __builtin_altivec_vupkhsh(__a); 12724 #endif 12725 } 12726 12727 static __inline__ vector bool int __ATTRS_o_ai 12728 vec_vupkhsh(vector bool short __a) { 12729 #ifdef __LITTLE_ENDIAN__ 12730 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12731 #else 12732 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12733 #endif 12734 } 12735 12736 static __inline__ vector unsigned int __ATTRS_o_ai 12737 vec_vupkhsh(vector pixel __a) { 12738 #ifdef __LITTLE_ENDIAN__ 12739 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12740 #else 12741 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12742 #endif 12743 } 12744 12745 /* vec_vupkhsw */ 12746 12747 #ifdef __POWER8_VECTOR__ 12748 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 12749 #ifdef __LITTLE_ENDIAN__ 12750 return __builtin_altivec_vupklsw(__a); 12751 #else 12752 return __builtin_altivec_vupkhsw(__a); 12753 #endif 12754 } 12755 12756 static __inline__ vector bool long long __ATTRS_o_ai 12757 vec_vupkhsw(vector bool int __a) { 12758 #ifdef __LITTLE_ENDIAN__ 12759 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12760 #else 12761 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12762 #endif 12763 } 12764 #endif 12765 12766 /* vec_unpackl */ 12767 12768 static __inline__ vector short __ATTRS_o_ai 12769 vec_unpackl(vector signed char __a) { 12770 #ifdef __LITTLE_ENDIAN__ 12771 return __builtin_altivec_vupkhsb((vector char)__a); 12772 #else 12773 return __builtin_altivec_vupklsb((vector char)__a); 12774 #endif 12775 } 12776 12777 static __inline__ vector bool short __ATTRS_o_ai 12778 vec_unpackl(vector bool char __a) { 12779 #ifdef __LITTLE_ENDIAN__ 12780 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12781 #else 12782 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12783 #endif 12784 } 12785 12786 static __inline__ vector int __ATTRS_o_ai vec_unpackl(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_unpackl(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_unpackl(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 #ifdef __POWER8_VECTOR__ 12813 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 12814 #ifdef __LITTLE_ENDIAN__ 12815 return __builtin_altivec_vupkhsw(__a); 12816 #else 12817 return __builtin_altivec_vupklsw(__a); 12818 #endif 12819 } 12820 12821 static __inline__ vector bool long long __ATTRS_o_ai 12822 vec_unpackl(vector bool int __a) { 12823 #ifdef __LITTLE_ENDIAN__ 12824 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12825 #else 12826 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12827 #endif 12828 } 12829 12830 static __inline__ vector double __ATTRS_o_ai 12831 vec_unpackl(vector float __a) { 12832 return (vector double)(__a[2], __a[3]); 12833 } 12834 #endif 12835 12836 /* vec_vupklsb */ 12837 12838 static __inline__ vector short __ATTRS_o_ai 12839 vec_vupklsb(vector signed char __a) { 12840 #ifdef __LITTLE_ENDIAN__ 12841 return __builtin_altivec_vupkhsb((vector char)__a); 12842 #else 12843 return __builtin_altivec_vupklsb((vector char)__a); 12844 #endif 12845 } 12846 12847 static __inline__ vector bool short __ATTRS_o_ai 12848 vec_vupklsb(vector bool char __a) { 12849 #ifdef __LITTLE_ENDIAN__ 12850 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12851 #else 12852 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12853 #endif 12854 } 12855 12856 /* vec_vupklsh */ 12857 12858 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 12859 #ifdef __LITTLE_ENDIAN__ 12860 return __builtin_altivec_vupkhsh(__a); 12861 #else 12862 return __builtin_altivec_vupklsh(__a); 12863 #endif 12864 } 12865 12866 static __inline__ vector bool int __ATTRS_o_ai 12867 vec_vupklsh(vector bool short __a) { 12868 #ifdef __LITTLE_ENDIAN__ 12869 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12870 #else 12871 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12872 #endif 12873 } 12874 12875 static __inline__ vector unsigned int __ATTRS_o_ai 12876 vec_vupklsh(vector pixel __a) { 12877 #ifdef __LITTLE_ENDIAN__ 12878 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12879 #else 12880 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12881 #endif 12882 } 12883 12884 /* vec_vupklsw */ 12885 12886 #ifdef __POWER8_VECTOR__ 12887 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 12888 #ifdef __LITTLE_ENDIAN__ 12889 return __builtin_altivec_vupkhsw(__a); 12890 #else 12891 return __builtin_altivec_vupklsw(__a); 12892 #endif 12893 } 12894 12895 static __inline__ vector bool long long __ATTRS_o_ai 12896 vec_vupklsw(vector bool int __a) { 12897 #ifdef __LITTLE_ENDIAN__ 12898 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12899 #else 12900 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12901 #endif 12902 } 12903 #endif 12904 12905 /* vec_vsx_ld */ 12906 12907 #ifdef __VSX__ 12908 12909 static __inline__ vector bool int __ATTRS_o_ai 12910 vec_vsx_ld(int __a, const vector bool int *__b) { 12911 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 12912 } 12913 12914 static __inline__ vector signed int __ATTRS_o_ai 12915 vec_vsx_ld(int __a, const vector signed int *__b) { 12916 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12917 } 12918 12919 static __inline__ vector signed int __ATTRS_o_ai 12920 vec_vsx_ld(int __a, const signed int *__b) { 12921 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12922 } 12923 12924 static __inline__ vector unsigned int __ATTRS_o_ai 12925 vec_vsx_ld(int __a, const vector unsigned int *__b) { 12926 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12927 } 12928 12929 static __inline__ vector unsigned int __ATTRS_o_ai 12930 vec_vsx_ld(int __a, const unsigned int *__b) { 12931 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12932 } 12933 12934 static __inline__ vector float __ATTRS_o_ai 12935 vec_vsx_ld(int __a, const vector float *__b) { 12936 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12937 } 12938 12939 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 12940 const float *__b) { 12941 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12942 } 12943 12944 static __inline__ vector signed long long __ATTRS_o_ai 12945 vec_vsx_ld(int __a, const vector signed long long *__b) { 12946 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 12947 } 12948 12949 static __inline__ vector unsigned long long __ATTRS_o_ai 12950 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 12951 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 12952 } 12953 12954 static __inline__ vector double __ATTRS_o_ai 12955 vec_vsx_ld(int __a, const vector double *__b) { 12956 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12957 } 12958 12959 static __inline__ vector double __ATTRS_o_ai 12960 vec_vsx_ld(int __a, const double *__b) { 12961 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12962 } 12963 12964 static __inline__ vector bool short __ATTRS_o_ai 12965 vec_vsx_ld(int __a, const vector bool short *__b) { 12966 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12967 } 12968 12969 static __inline__ vector signed short __ATTRS_o_ai 12970 vec_vsx_ld(int __a, const vector signed short *__b) { 12971 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12972 } 12973 12974 static __inline__ vector signed short __ATTRS_o_ai 12975 vec_vsx_ld(int __a, const signed short *__b) { 12976 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12977 } 12978 12979 static __inline__ vector unsigned short __ATTRS_o_ai 12980 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12981 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12982 } 12983 12984 static __inline__ vector unsigned short __ATTRS_o_ai 12985 vec_vsx_ld(int __a, const unsigned short *__b) { 12986 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12987 } 12988 12989 static __inline__ vector bool char __ATTRS_o_ai 12990 vec_vsx_ld(int __a, const vector bool char *__b) { 12991 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12992 } 12993 12994 static __inline__ vector signed char __ATTRS_o_ai 12995 vec_vsx_ld(int __a, const vector signed char *__b) { 12996 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12997 } 12998 12999 static __inline__ vector signed char __ATTRS_o_ai 13000 vec_vsx_ld(int __a, const signed char *__b) { 13001 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 13002 } 13003 13004 static __inline__ vector unsigned char __ATTRS_o_ai 13005 vec_vsx_ld(int __a, const vector unsigned char *__b) { 13006 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 13007 } 13008 13009 static __inline__ vector unsigned char __ATTRS_o_ai 13010 vec_vsx_ld(int __a, const unsigned char *__b) { 13011 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 13012 } 13013 13014 #endif 13015 13016 /* vec_vsx_st */ 13017 13018 #ifdef __VSX__ 13019 13020 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 13021 vector bool int *__c) { 13022 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13023 } 13024 13025 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 13026 signed int *__c) { 13027 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13028 } 13029 13030 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 13031 unsigned int *__c) { 13032 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13033 } 13034 13035 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 13036 vector signed int *__c) { 13037 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13038 } 13039 13040 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 13041 signed int *__c) { 13042 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13043 } 13044 13045 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 13046 vector unsigned int *__c) { 13047 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13048 } 13049 13050 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 13051 unsigned int *__c) { 13052 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13053 } 13054 13055 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 13056 vector float *__c) { 13057 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13058 } 13059 13060 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 13061 float *__c) { 13062 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13063 } 13064 13065 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 13066 int __b, 13067 vector signed long long *__c) { 13068 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13069 } 13070 13071 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 13072 int __b, 13073 vector unsigned long long *__c) { 13074 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13075 } 13076 13077 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 13078 vector double *__c) { 13079 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13080 } 13081 13082 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 13083 double *__c) { 13084 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13085 } 13086 13087 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13088 vector bool short *__c) { 13089 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13090 } 13091 13092 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13093 signed short *__c) { 13094 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13095 } 13096 13097 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13098 unsigned short *__c) { 13099 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13100 } 13101 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13102 vector signed short *__c) { 13103 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13104 } 13105 13106 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13107 signed short *__c) { 13108 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13109 } 13110 13111 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13112 int __b, 13113 vector unsigned short *__c) { 13114 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13115 } 13116 13117 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13118 int __b, unsigned short *__c) { 13119 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13120 } 13121 13122 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13123 vector bool char *__c) { 13124 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13125 } 13126 13127 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13128 signed char *__c) { 13129 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13130 } 13131 13132 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13133 unsigned char *__c) { 13134 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13135 } 13136 13137 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13138 vector signed char *__c) { 13139 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13140 } 13141 13142 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13143 signed char *__c) { 13144 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13145 } 13146 13147 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13148 int __b, 13149 vector unsigned char *__c) { 13150 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13151 } 13152 13153 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13154 int __b, unsigned char *__c) { 13155 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13156 } 13157 13158 #endif 13159 13160 #ifdef __VSX__ 13161 #define vec_xxpermdi __builtin_vsx_xxpermdi 13162 #define vec_xxsldwi __builtin_vsx_xxsldwi 13163 #define vec_permi(__a, __b, __c) \ 13164 _Generic((__a), vector signed long long \ 13165 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13166 (((__c)&0x1) + 2)), \ 13167 vector unsigned long long \ 13168 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13169 (((__c)&0x1) + 2)), \ 13170 vector double \ 13171 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13172 (((__c)&0x1) + 2))) 13173 #endif 13174 13175 /* vec_xor */ 13176 13177 #define __builtin_altivec_vxor vec_xor 13178 13179 static __inline__ vector signed char __ATTRS_o_ai 13180 vec_xor(vector signed char __a, vector signed char __b) { 13181 return __a ^ __b; 13182 } 13183 13184 static __inline__ vector signed char __ATTRS_o_ai 13185 vec_xor(vector bool char __a, vector signed char __b) { 13186 return (vector signed char)__a ^ __b; 13187 } 13188 13189 static __inline__ vector signed char __ATTRS_o_ai 13190 vec_xor(vector signed char __a, vector bool char __b) { 13191 return __a ^ (vector signed char)__b; 13192 } 13193 13194 static __inline__ vector unsigned char __ATTRS_o_ai 13195 vec_xor(vector unsigned char __a, vector unsigned char __b) { 13196 return __a ^ __b; 13197 } 13198 13199 static __inline__ vector unsigned char __ATTRS_o_ai 13200 vec_xor(vector bool char __a, vector unsigned char __b) { 13201 return (vector unsigned char)__a ^ __b; 13202 } 13203 13204 static __inline__ vector unsigned char __ATTRS_o_ai 13205 vec_xor(vector unsigned char __a, vector bool char __b) { 13206 return __a ^ (vector unsigned char)__b; 13207 } 13208 13209 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 13210 vector bool char __b) { 13211 return __a ^ __b; 13212 } 13213 13214 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13215 vector short __b) { 13216 return __a ^ __b; 13217 } 13218 13219 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 13220 vector short __b) { 13221 return (vector short)__a ^ __b; 13222 } 13223 13224 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13225 vector bool short __b) { 13226 return __a ^ (vector short)__b; 13227 } 13228 13229 static __inline__ vector unsigned short __ATTRS_o_ai 13230 vec_xor(vector unsigned short __a, vector unsigned short __b) { 13231 return __a ^ __b; 13232 } 13233 13234 static __inline__ vector unsigned short __ATTRS_o_ai 13235 vec_xor(vector bool short __a, vector unsigned short __b) { 13236 return (vector unsigned short)__a ^ __b; 13237 } 13238 13239 static __inline__ vector unsigned short __ATTRS_o_ai 13240 vec_xor(vector unsigned short __a, vector bool short __b) { 13241 return __a ^ (vector unsigned short)__b; 13242 } 13243 13244 static __inline__ vector bool short __ATTRS_o_ai 13245 vec_xor(vector bool short __a, vector bool short __b) { 13246 return __a ^ __b; 13247 } 13248 13249 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13250 vector int __b) { 13251 return __a ^ __b; 13252 } 13253 13254 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 13255 vector int __b) { 13256 return (vector int)__a ^ __b; 13257 } 13258 13259 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13260 vector bool int __b) { 13261 return __a ^ (vector int)__b; 13262 } 13263 13264 static __inline__ vector unsigned int __ATTRS_o_ai 13265 vec_xor(vector unsigned int __a, vector unsigned int __b) { 13266 return __a ^ __b; 13267 } 13268 13269 static __inline__ vector unsigned int __ATTRS_o_ai 13270 vec_xor(vector bool int __a, vector unsigned int __b) { 13271 return (vector unsigned int)__a ^ __b; 13272 } 13273 13274 static __inline__ vector unsigned int __ATTRS_o_ai 13275 vec_xor(vector unsigned int __a, vector bool int __b) { 13276 return __a ^ (vector unsigned int)__b; 13277 } 13278 13279 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 13280 vector bool int __b) { 13281 return __a ^ __b; 13282 } 13283 13284 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13285 vector float __b) { 13286 vector unsigned int __res = 13287 (vector unsigned int)__a ^ (vector unsigned int)__b; 13288 return (vector float)__res; 13289 } 13290 13291 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 13292 vector float __b) { 13293 vector unsigned int __res = 13294 (vector unsigned int)__a ^ (vector unsigned int)__b; 13295 return (vector float)__res; 13296 } 13297 13298 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13299 vector bool int __b) { 13300 vector unsigned int __res = 13301 (vector unsigned int)__a ^ (vector unsigned int)__b; 13302 return (vector float)__res; 13303 } 13304 13305 #ifdef __VSX__ 13306 static __inline__ vector signed long long __ATTRS_o_ai 13307 vec_xor(vector signed long long __a, vector signed long long __b) { 13308 return __a ^ __b; 13309 } 13310 13311 static __inline__ vector signed long long __ATTRS_o_ai 13312 vec_xor(vector bool long long __a, vector signed long long __b) { 13313 return (vector signed long long)__a ^ __b; 13314 } 13315 13316 static __inline__ vector signed long long __ATTRS_o_ai 13317 vec_xor(vector signed long long __a, vector bool long long __b) { 13318 return __a ^ (vector signed long long)__b; 13319 } 13320 13321 static __inline__ vector unsigned long long __ATTRS_o_ai 13322 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 13323 return __a ^ __b; 13324 } 13325 13326 static __inline__ vector unsigned long long __ATTRS_o_ai 13327 vec_xor(vector bool long long __a, vector unsigned long long __b) { 13328 return (vector unsigned long long)__a ^ __b; 13329 } 13330 13331 static __inline__ vector unsigned long long __ATTRS_o_ai 13332 vec_xor(vector unsigned long long __a, vector bool long long __b) { 13333 return __a ^ (vector unsigned long long)__b; 13334 } 13335 13336 static __inline__ vector bool long long __ATTRS_o_ai 13337 vec_xor(vector bool long long __a, vector bool long long __b) { 13338 return __a ^ __b; 13339 } 13340 13341 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 13342 vector double __b) { 13343 return (vector double)((vector unsigned long long)__a ^ 13344 (vector unsigned long long)__b); 13345 } 13346 13347 static __inline__ vector double __ATTRS_o_ai 13348 vec_xor(vector double __a, vector bool long long __b) { 13349 return (vector double)((vector unsigned long long)__a ^ 13350 (vector unsigned long long)__b); 13351 } 13352 13353 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 13354 vector double __b) { 13355 return (vector double)((vector unsigned long long)__a ^ 13356 (vector unsigned long long)__b); 13357 } 13358 #endif 13359 13360 /* vec_vxor */ 13361 13362 static __inline__ vector signed char __ATTRS_o_ai 13363 vec_vxor(vector signed char __a, vector signed char __b) { 13364 return __a ^ __b; 13365 } 13366 13367 static __inline__ vector signed char __ATTRS_o_ai 13368 vec_vxor(vector bool char __a, vector signed char __b) { 13369 return (vector signed char)__a ^ __b; 13370 } 13371 13372 static __inline__ vector signed char __ATTRS_o_ai 13373 vec_vxor(vector signed char __a, vector bool char __b) { 13374 return __a ^ (vector signed char)__b; 13375 } 13376 13377 static __inline__ vector unsigned char __ATTRS_o_ai 13378 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 13379 return __a ^ __b; 13380 } 13381 13382 static __inline__ vector unsigned char __ATTRS_o_ai 13383 vec_vxor(vector bool char __a, vector unsigned char __b) { 13384 return (vector unsigned char)__a ^ __b; 13385 } 13386 13387 static __inline__ vector unsigned char __ATTRS_o_ai 13388 vec_vxor(vector unsigned char __a, vector bool char __b) { 13389 return __a ^ (vector unsigned char)__b; 13390 } 13391 13392 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 13393 vector bool char __b) { 13394 return __a ^ __b; 13395 } 13396 13397 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13398 vector short __b) { 13399 return __a ^ __b; 13400 } 13401 13402 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 13403 vector short __b) { 13404 return (vector short)__a ^ __b; 13405 } 13406 13407 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13408 vector bool short __b) { 13409 return __a ^ (vector short)__b; 13410 } 13411 13412 static __inline__ vector unsigned short __ATTRS_o_ai 13413 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 13414 return __a ^ __b; 13415 } 13416 13417 static __inline__ vector unsigned short __ATTRS_o_ai 13418 vec_vxor(vector bool short __a, vector unsigned short __b) { 13419 return (vector unsigned short)__a ^ __b; 13420 } 13421 13422 static __inline__ vector unsigned short __ATTRS_o_ai 13423 vec_vxor(vector unsigned short __a, vector bool short __b) { 13424 return __a ^ (vector unsigned short)__b; 13425 } 13426 13427 static __inline__ vector bool short __ATTRS_o_ai 13428 vec_vxor(vector bool short __a, vector bool short __b) { 13429 return __a ^ __b; 13430 } 13431 13432 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13433 vector int __b) { 13434 return __a ^ __b; 13435 } 13436 13437 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 13438 vector int __b) { 13439 return (vector int)__a ^ __b; 13440 } 13441 13442 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13443 vector bool int __b) { 13444 return __a ^ (vector int)__b; 13445 } 13446 13447 static __inline__ vector unsigned int __ATTRS_o_ai 13448 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 13449 return __a ^ __b; 13450 } 13451 13452 static __inline__ vector unsigned int __ATTRS_o_ai 13453 vec_vxor(vector bool int __a, vector unsigned int __b) { 13454 return (vector unsigned int)__a ^ __b; 13455 } 13456 13457 static __inline__ vector unsigned int __ATTRS_o_ai 13458 vec_vxor(vector unsigned int __a, vector bool int __b) { 13459 return __a ^ (vector unsigned int)__b; 13460 } 13461 13462 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 13463 vector bool int __b) { 13464 return __a ^ __b; 13465 } 13466 13467 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13468 vector float __b) { 13469 vector unsigned int __res = 13470 (vector unsigned int)__a ^ (vector unsigned int)__b; 13471 return (vector float)__res; 13472 } 13473 13474 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 13475 vector float __b) { 13476 vector unsigned int __res = 13477 (vector unsigned int)__a ^ (vector unsigned int)__b; 13478 return (vector float)__res; 13479 } 13480 13481 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13482 vector bool int __b) { 13483 vector unsigned int __res = 13484 (vector unsigned int)__a ^ (vector unsigned int)__b; 13485 return (vector float)__res; 13486 } 13487 13488 #ifdef __VSX__ 13489 static __inline__ vector signed long long __ATTRS_o_ai 13490 vec_vxor(vector signed long long __a, vector signed long long __b) { 13491 return __a ^ __b; 13492 } 13493 13494 static __inline__ vector signed long long __ATTRS_o_ai 13495 vec_vxor(vector bool long long __a, vector signed long long __b) { 13496 return (vector signed long long)__a ^ __b; 13497 } 13498 13499 static __inline__ vector signed long long __ATTRS_o_ai 13500 vec_vxor(vector signed long long __a, vector bool long long __b) { 13501 return __a ^ (vector signed long long)__b; 13502 } 13503 13504 static __inline__ vector unsigned long long __ATTRS_o_ai 13505 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 13506 return __a ^ __b; 13507 } 13508 13509 static __inline__ vector unsigned long long __ATTRS_o_ai 13510 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 13511 return (vector unsigned long long)__a ^ __b; 13512 } 13513 13514 static __inline__ vector unsigned long long __ATTRS_o_ai 13515 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 13516 return __a ^ (vector unsigned long long)__b; 13517 } 13518 13519 static __inline__ vector bool long long __ATTRS_o_ai 13520 vec_vxor(vector bool long long __a, vector bool long long __b) { 13521 return __a ^ __b; 13522 } 13523 #endif 13524 13525 /* ------------------------ extensions for CBEA ----------------------------- */ 13526 13527 /* vec_extract */ 13528 13529 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 13530 signed int __b) { 13531 return __a[__b & 0xf]; 13532 } 13533 13534 static __inline__ unsigned char __ATTRS_o_ai 13535 vec_extract(vector unsigned char __a, signed int __b) { 13536 return __a[__b & 0xf]; 13537 } 13538 13539 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 13540 signed int __b) { 13541 return __a[__b & 0xf]; 13542 } 13543 13544 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 13545 signed int __b) { 13546 return __a[__b & 0x7]; 13547 } 13548 13549 static __inline__ unsigned short __ATTRS_o_ai 13550 vec_extract(vector unsigned short __a, signed int __b) { 13551 return __a[__b & 0x7]; 13552 } 13553 13554 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 13555 signed int __b) { 13556 return __a[__b & 0x7]; 13557 } 13558 13559 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 13560 signed int __b) { 13561 return __a[__b & 0x3]; 13562 } 13563 13564 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 13565 signed int __b) { 13566 return __a[__b & 0x3]; 13567 } 13568 13569 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 13570 signed int __b) { 13571 return __a[__b & 0x3]; 13572 } 13573 13574 #ifdef __VSX__ 13575 static __inline__ signed long long __ATTRS_o_ai 13576 vec_extract(vector signed long long __a, signed int __b) { 13577 return __a[__b & 0x1]; 13578 } 13579 13580 static __inline__ unsigned long long __ATTRS_o_ai 13581 vec_extract(vector unsigned long long __a, signed int __b) { 13582 return __a[__b & 0x1]; 13583 } 13584 13585 static __inline__ unsigned long long __ATTRS_o_ai 13586 vec_extract(vector bool long long __a, signed int __b) { 13587 return __a[__b & 0x1]; 13588 } 13589 13590 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, 13591 signed int __b) { 13592 return __a[__b & 0x1]; 13593 } 13594 #endif 13595 13596 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, 13597 signed int __b) { 13598 return __a[__b & 0x3]; 13599 } 13600 13601 #ifdef __POWER9_VECTOR__ 13602 13603 #define vec_insert4b __builtin_vsx_insertword 13604 #define vec_extract4b __builtin_vsx_extractuword 13605 13606 /* vec_extract_exp */ 13607 13608 static __inline__ vector unsigned int __ATTRS_o_ai 13609 vec_extract_exp(vector float __a) { 13610 return __builtin_vsx_xvxexpsp(__a); 13611 } 13612 13613 static __inline__ vector unsigned long long __ATTRS_o_ai 13614 vec_extract_exp(vector double __a) { 13615 return __builtin_vsx_xvxexpdp(__a); 13616 } 13617 13618 /* vec_extract_sig */ 13619 13620 static __inline__ vector unsigned int __ATTRS_o_ai 13621 vec_extract_sig(vector float __a) { 13622 return __builtin_vsx_xvxsigsp(__a); 13623 } 13624 13625 static __inline__ vector unsigned long long __ATTRS_o_ai 13626 vec_extract_sig (vector double __a) { 13627 return __builtin_vsx_xvxsigdp(__a); 13628 } 13629 13630 static __inline__ vector float __ATTRS_o_ai 13631 vec_extract_fp32_from_shorth(vector unsigned short __a) { 13632 vector unsigned short __b = 13633 #ifdef __LITTLE_ENDIAN__ 13634 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 13635 #else 13636 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 13637 #endif 13638 return __builtin_vsx_xvcvhpsp(__b); 13639 } 13640 13641 static __inline__ vector float __ATTRS_o_ai 13642 vec_extract_fp32_from_shortl(vector unsigned short __a) { 13643 vector unsigned short __b = 13644 #ifdef __LITTLE_ENDIAN__ 13645 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 13646 #else 13647 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 13648 #endif 13649 return __builtin_vsx_xvcvhpsp(__b); 13650 } 13651 #endif /* __POWER9_VECTOR__ */ 13652 13653 /* vec_insert */ 13654 13655 static __inline__ vector signed char __ATTRS_o_ai 13656 vec_insert(signed char __a, vector signed char __b, int __c) { 13657 __b[__c & 0xF] = __a; 13658 return __b; 13659 } 13660 13661 static __inline__ vector unsigned char __ATTRS_o_ai 13662 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 13663 __b[__c & 0xF] = __a; 13664 return __b; 13665 } 13666 13667 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 13668 vector bool char __b, 13669 int __c) { 13670 __b[__c & 0xF] = __a; 13671 return __b; 13672 } 13673 13674 static __inline__ vector signed short __ATTRS_o_ai 13675 vec_insert(signed short __a, vector signed short __b, int __c) { 13676 __b[__c & 0x7] = __a; 13677 return __b; 13678 } 13679 13680 static __inline__ vector unsigned short __ATTRS_o_ai 13681 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 13682 __b[__c & 0x7] = __a; 13683 return __b; 13684 } 13685 13686 static __inline__ vector bool short __ATTRS_o_ai 13687 vec_insert(unsigned short __a, vector bool short __b, int __c) { 13688 __b[__c & 0x7] = __a; 13689 return __b; 13690 } 13691 13692 static __inline__ vector signed int __ATTRS_o_ai 13693 vec_insert(signed int __a, vector signed int __b, int __c) { 13694 __b[__c & 0x3] = __a; 13695 return __b; 13696 } 13697 13698 static __inline__ vector unsigned int __ATTRS_o_ai 13699 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 13700 __b[__c & 0x3] = __a; 13701 return __b; 13702 } 13703 13704 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 13705 vector bool int __b, 13706 int __c) { 13707 __b[__c & 0x3] = __a; 13708 return __b; 13709 } 13710 13711 #ifdef __VSX__ 13712 static __inline__ vector signed long long __ATTRS_o_ai 13713 vec_insert(signed long long __a, vector signed long long __b, int __c) { 13714 __b[__c & 0x1] = __a; 13715 return __b; 13716 } 13717 13718 static __inline__ vector unsigned long long __ATTRS_o_ai 13719 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 13720 __b[__c & 0x1] = __a; 13721 return __b; 13722 } 13723 13724 static __inline__ vector bool long long __ATTRS_o_ai 13725 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 13726 __b[__c & 0x1] = __a; 13727 return __b; 13728 } 13729 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 13730 vector double __b, 13731 int __c) { 13732 __b[__c & 0x1] = __a; 13733 return __b; 13734 } 13735 #endif 13736 13737 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 13738 vector float __b, 13739 int __c) { 13740 __b[__c & 0x3] = __a; 13741 return __b; 13742 } 13743 13744 /* vec_lvlx */ 13745 13746 static __inline__ vector signed char __ATTRS_o_ai 13747 vec_lvlx(int __a, const signed char *__b) { 13748 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13749 vec_lvsl(__a, __b)); 13750 } 13751 13752 static __inline__ vector signed char __ATTRS_o_ai 13753 vec_lvlx(int __a, const vector signed char *__b) { 13754 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13755 vec_lvsl(__a, (unsigned char *)__b)); 13756 } 13757 13758 static __inline__ vector unsigned char __ATTRS_o_ai 13759 vec_lvlx(int __a, const unsigned char *__b) { 13760 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13761 vec_lvsl(__a, __b)); 13762 } 13763 13764 static __inline__ vector unsigned char __ATTRS_o_ai 13765 vec_lvlx(int __a, const vector unsigned char *__b) { 13766 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13767 vec_lvsl(__a, (unsigned char *)__b)); 13768 } 13769 13770 static __inline__ vector bool char __ATTRS_o_ai 13771 vec_lvlx(int __a, const vector bool char *__b) { 13772 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 13773 vec_lvsl(__a, (unsigned char *)__b)); 13774 } 13775 13776 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13777 const short *__b) { 13778 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13779 } 13780 13781 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13782 const vector short *__b) { 13783 return vec_perm(vec_ld(__a, __b), (vector short)(0), 13784 vec_lvsl(__a, (unsigned char *)__b)); 13785 } 13786 13787 static __inline__ vector unsigned short __ATTRS_o_ai 13788 vec_lvlx(int __a, const unsigned short *__b) { 13789 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13790 vec_lvsl(__a, __b)); 13791 } 13792 13793 static __inline__ vector unsigned short __ATTRS_o_ai 13794 vec_lvlx(int __a, const vector unsigned short *__b) { 13795 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13796 vec_lvsl(__a, (unsigned char *)__b)); 13797 } 13798 13799 static __inline__ vector bool short __ATTRS_o_ai 13800 vec_lvlx(int __a, const vector bool short *__b) { 13801 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 13802 vec_lvsl(__a, (unsigned char *)__b)); 13803 } 13804 13805 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 13806 const vector pixel *__b) { 13807 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 13808 vec_lvsl(__a, (unsigned char *)__b)); 13809 } 13810 13811 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 13812 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13813 } 13814 13815 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 13816 const vector int *__b) { 13817 return vec_perm(vec_ld(__a, __b), (vector int)(0), 13818 vec_lvsl(__a, (unsigned char *)__b)); 13819 } 13820 13821 static __inline__ vector unsigned int __ATTRS_o_ai 13822 vec_lvlx(int __a, const unsigned int *__b) { 13823 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13824 vec_lvsl(__a, __b)); 13825 } 13826 13827 static __inline__ vector unsigned int __ATTRS_o_ai 13828 vec_lvlx(int __a, const vector unsigned int *__b) { 13829 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13830 vec_lvsl(__a, (unsigned char *)__b)); 13831 } 13832 13833 static __inline__ vector bool int __ATTRS_o_ai 13834 vec_lvlx(int __a, const vector bool int *__b) { 13835 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 13836 vec_lvsl(__a, (unsigned char *)__b)); 13837 } 13838 13839 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13840 const float *__b) { 13841 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13842 } 13843 13844 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13845 const vector float *__b) { 13846 return vec_perm(vec_ld(__a, __b), (vector float)(0), 13847 vec_lvsl(__a, (unsigned char *)__b)); 13848 } 13849 13850 /* vec_lvlxl */ 13851 13852 static __inline__ vector signed char __ATTRS_o_ai 13853 vec_lvlxl(int __a, const signed char *__b) { 13854 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13855 vec_lvsl(__a, __b)); 13856 } 13857 13858 static __inline__ vector signed char __ATTRS_o_ai 13859 vec_lvlxl(int __a, const vector signed char *__b) { 13860 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13861 vec_lvsl(__a, (unsigned char *)__b)); 13862 } 13863 13864 static __inline__ vector unsigned char __ATTRS_o_ai 13865 vec_lvlxl(int __a, const unsigned char *__b) { 13866 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13867 vec_lvsl(__a, __b)); 13868 } 13869 13870 static __inline__ vector unsigned char __ATTRS_o_ai 13871 vec_lvlxl(int __a, const vector unsigned char *__b) { 13872 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13873 vec_lvsl(__a, (unsigned char *)__b)); 13874 } 13875 13876 static __inline__ vector bool char __ATTRS_o_ai 13877 vec_lvlxl(int __a, const vector bool char *__b) { 13878 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 13879 vec_lvsl(__a, (unsigned char *)__b)); 13880 } 13881 13882 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13883 const short *__b) { 13884 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13885 } 13886 13887 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13888 const vector short *__b) { 13889 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 13890 vec_lvsl(__a, (unsigned char *)__b)); 13891 } 13892 13893 static __inline__ vector unsigned short __ATTRS_o_ai 13894 vec_lvlxl(int __a, const unsigned short *__b) { 13895 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13896 vec_lvsl(__a, __b)); 13897 } 13898 13899 static __inline__ vector unsigned short __ATTRS_o_ai 13900 vec_lvlxl(int __a, const vector unsigned short *__b) { 13901 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13902 vec_lvsl(__a, (unsigned char *)__b)); 13903 } 13904 13905 static __inline__ vector bool short __ATTRS_o_ai 13906 vec_lvlxl(int __a, const vector bool short *__b) { 13907 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 13908 vec_lvsl(__a, (unsigned char *)__b)); 13909 } 13910 13911 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 13912 const vector pixel *__b) { 13913 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 13914 vec_lvsl(__a, (unsigned char *)__b)); 13915 } 13916 13917 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 13918 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13919 } 13920 13921 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 13922 const vector int *__b) { 13923 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 13924 vec_lvsl(__a, (unsigned char *)__b)); 13925 } 13926 13927 static __inline__ vector unsigned int __ATTRS_o_ai 13928 vec_lvlxl(int __a, const unsigned int *__b) { 13929 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13930 vec_lvsl(__a, __b)); 13931 } 13932 13933 static __inline__ vector unsigned int __ATTRS_o_ai 13934 vec_lvlxl(int __a, const vector unsigned int *__b) { 13935 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13936 vec_lvsl(__a, (unsigned char *)__b)); 13937 } 13938 13939 static __inline__ vector bool int __ATTRS_o_ai 13940 vec_lvlxl(int __a, const vector bool int *__b) { 13941 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 13942 vec_lvsl(__a, (unsigned char *)__b)); 13943 } 13944 13945 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13946 const float *__b) { 13947 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13948 } 13949 13950 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13951 vector float *__b) { 13952 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 13953 vec_lvsl(__a, (unsigned char *)__b)); 13954 } 13955 13956 /* vec_lvrx */ 13957 13958 static __inline__ vector signed char __ATTRS_o_ai 13959 vec_lvrx(int __a, const signed char *__b) { 13960 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13961 vec_lvsl(__a, __b)); 13962 } 13963 13964 static __inline__ vector signed char __ATTRS_o_ai 13965 vec_lvrx(int __a, const vector signed char *__b) { 13966 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13967 vec_lvsl(__a, (unsigned char *)__b)); 13968 } 13969 13970 static __inline__ vector unsigned char __ATTRS_o_ai 13971 vec_lvrx(int __a, const unsigned char *__b) { 13972 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13973 vec_lvsl(__a, __b)); 13974 } 13975 13976 static __inline__ vector unsigned char __ATTRS_o_ai 13977 vec_lvrx(int __a, const vector unsigned char *__b) { 13978 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13979 vec_lvsl(__a, (unsigned char *)__b)); 13980 } 13981 13982 static __inline__ vector bool char __ATTRS_o_ai 13983 vec_lvrx(int __a, const vector bool char *__b) { 13984 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13985 vec_lvsl(__a, (unsigned char *)__b)); 13986 } 13987 13988 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13989 const short *__b) { 13990 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13991 } 13992 13993 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13994 const vector short *__b) { 13995 return vec_perm((vector short)(0), vec_ld(__a, __b), 13996 vec_lvsl(__a, (unsigned char *)__b)); 13997 } 13998 13999 static __inline__ vector unsigned short __ATTRS_o_ai 14000 vec_lvrx(int __a, const unsigned short *__b) { 14001 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 14002 vec_lvsl(__a, __b)); 14003 } 14004 14005 static __inline__ vector unsigned short __ATTRS_o_ai 14006 vec_lvrx(int __a, const vector unsigned short *__b) { 14007 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 14008 vec_lvsl(__a, (unsigned char *)__b)); 14009 } 14010 14011 static __inline__ vector bool short __ATTRS_o_ai 14012 vec_lvrx(int __a, const vector bool short *__b) { 14013 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 14014 vec_lvsl(__a, (unsigned char *)__b)); 14015 } 14016 14017 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 14018 const vector pixel *__b) { 14019 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 14020 vec_lvsl(__a, (unsigned char *)__b)); 14021 } 14022 14023 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 14024 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 14025 } 14026 14027 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 14028 const vector int *__b) { 14029 return vec_perm((vector int)(0), vec_ld(__a, __b), 14030 vec_lvsl(__a, (unsigned char *)__b)); 14031 } 14032 14033 static __inline__ vector unsigned int __ATTRS_o_ai 14034 vec_lvrx(int __a, const unsigned int *__b) { 14035 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 14036 vec_lvsl(__a, __b)); 14037 } 14038 14039 static __inline__ vector unsigned int __ATTRS_o_ai 14040 vec_lvrx(int __a, const vector unsigned int *__b) { 14041 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 14042 vec_lvsl(__a, (unsigned char *)__b)); 14043 } 14044 14045 static __inline__ vector bool int __ATTRS_o_ai 14046 vec_lvrx(int __a, const vector bool int *__b) { 14047 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 14048 vec_lvsl(__a, (unsigned char *)__b)); 14049 } 14050 14051 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 14052 const float *__b) { 14053 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 14054 } 14055 14056 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 14057 const vector float *__b) { 14058 return vec_perm((vector float)(0), vec_ld(__a, __b), 14059 vec_lvsl(__a, (unsigned char *)__b)); 14060 } 14061 14062 /* vec_lvrxl */ 14063 14064 static __inline__ vector signed char __ATTRS_o_ai 14065 vec_lvrxl(int __a, const signed char *__b) { 14066 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 14067 vec_lvsl(__a, __b)); 14068 } 14069 14070 static __inline__ vector signed char __ATTRS_o_ai 14071 vec_lvrxl(int __a, const vector signed char *__b) { 14072 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 14073 vec_lvsl(__a, (unsigned char *)__b)); 14074 } 14075 14076 static __inline__ vector unsigned char __ATTRS_o_ai 14077 vec_lvrxl(int __a, const unsigned char *__b) { 14078 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 14079 vec_lvsl(__a, __b)); 14080 } 14081 14082 static __inline__ vector unsigned char __ATTRS_o_ai 14083 vec_lvrxl(int __a, const vector unsigned char *__b) { 14084 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 14085 vec_lvsl(__a, (unsigned char *)__b)); 14086 } 14087 14088 static __inline__ vector bool char __ATTRS_o_ai 14089 vec_lvrxl(int __a, const vector bool char *__b) { 14090 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 14091 vec_lvsl(__a, (unsigned char *)__b)); 14092 } 14093 14094 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14095 const short *__b) { 14096 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14097 } 14098 14099 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14100 const vector short *__b) { 14101 return vec_perm((vector short)(0), vec_ldl(__a, __b), 14102 vec_lvsl(__a, (unsigned char *)__b)); 14103 } 14104 14105 static __inline__ vector unsigned short __ATTRS_o_ai 14106 vec_lvrxl(int __a, const unsigned short *__b) { 14107 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14108 vec_lvsl(__a, __b)); 14109 } 14110 14111 static __inline__ vector unsigned short __ATTRS_o_ai 14112 vec_lvrxl(int __a, const vector unsigned short *__b) { 14113 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14114 vec_lvsl(__a, (unsigned char *)__b)); 14115 } 14116 14117 static __inline__ vector bool short __ATTRS_o_ai 14118 vec_lvrxl(int __a, const vector bool short *__b) { 14119 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 14120 vec_lvsl(__a, (unsigned char *)__b)); 14121 } 14122 14123 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 14124 const vector pixel *__b) { 14125 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 14126 vec_lvsl(__a, (unsigned char *)__b)); 14127 } 14128 14129 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 14130 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14131 } 14132 14133 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 14134 const vector int *__b) { 14135 return vec_perm((vector int)(0), vec_ldl(__a, __b), 14136 vec_lvsl(__a, (unsigned char *)__b)); 14137 } 14138 14139 static __inline__ vector unsigned int __ATTRS_o_ai 14140 vec_lvrxl(int __a, const unsigned int *__b) { 14141 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14142 vec_lvsl(__a, __b)); 14143 } 14144 14145 static __inline__ vector unsigned int __ATTRS_o_ai 14146 vec_lvrxl(int __a, const vector unsigned int *__b) { 14147 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14148 vec_lvsl(__a, (unsigned char *)__b)); 14149 } 14150 14151 static __inline__ vector bool int __ATTRS_o_ai 14152 vec_lvrxl(int __a, const vector bool int *__b) { 14153 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 14154 vec_lvsl(__a, (unsigned char *)__b)); 14155 } 14156 14157 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14158 const float *__b) { 14159 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14160 } 14161 14162 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14163 const vector float *__b) { 14164 return vec_perm((vector float)(0), vec_ldl(__a, __b), 14165 vec_lvsl(__a, (unsigned char *)__b)); 14166 } 14167 14168 /* vec_stvlx */ 14169 14170 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14171 signed char *__c) { 14172 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14173 __c); 14174 } 14175 14176 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14177 vector signed char *__c) { 14178 return vec_st( 14179 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14180 __b, __c); 14181 } 14182 14183 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14184 unsigned char *__c) { 14185 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14186 __c); 14187 } 14188 14189 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14190 vector unsigned char *__c) { 14191 return vec_st( 14192 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14193 __b, __c); 14194 } 14195 14196 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 14197 vector bool char *__c) { 14198 return vec_st( 14199 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14200 __b, __c); 14201 } 14202 14203 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14204 short *__c) { 14205 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14206 __c); 14207 } 14208 14209 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14210 vector short *__c) { 14211 return vec_st( 14212 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14213 __b, __c); 14214 } 14215 14216 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14217 int __b, unsigned short *__c) { 14218 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14219 __c); 14220 } 14221 14222 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14223 int __b, 14224 vector unsigned short *__c) { 14225 return vec_st( 14226 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14227 __b, __c); 14228 } 14229 14230 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 14231 vector bool short *__c) { 14232 return vec_st( 14233 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14234 __b, __c); 14235 } 14236 14237 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 14238 vector pixel *__c) { 14239 return vec_st( 14240 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14241 __b, __c); 14242 } 14243 14244 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14245 int *__c) { 14246 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14247 __c); 14248 } 14249 14250 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14251 vector int *__c) { 14252 return vec_st( 14253 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14254 __b, __c); 14255 } 14256 14257 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14258 unsigned int *__c) { 14259 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14260 __c); 14261 } 14262 14263 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14264 vector unsigned int *__c) { 14265 return vec_st( 14266 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14267 __b, __c); 14268 } 14269 14270 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 14271 vector bool int *__c) { 14272 return vec_st( 14273 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14274 __b, __c); 14275 } 14276 14277 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 14278 vector float *__c) { 14279 return vec_st( 14280 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14281 __b, __c); 14282 } 14283 14284 /* vec_stvlxl */ 14285 14286 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14287 signed char *__c) { 14288 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14289 __c); 14290 } 14291 14292 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14293 vector signed char *__c) { 14294 return vec_stl( 14295 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14296 __b, __c); 14297 } 14298 14299 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14300 int __b, unsigned char *__c) { 14301 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14302 __c); 14303 } 14304 14305 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14306 int __b, 14307 vector unsigned char *__c) { 14308 return vec_stl( 14309 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14310 __b, __c); 14311 } 14312 14313 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 14314 vector bool char *__c) { 14315 return vec_stl( 14316 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14317 __b, __c); 14318 } 14319 14320 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14321 short *__c) { 14322 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14323 __c); 14324 } 14325 14326 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14327 vector short *__c) { 14328 return vec_stl( 14329 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14330 __b, __c); 14331 } 14332 14333 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14334 int __b, unsigned short *__c) { 14335 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14336 __c); 14337 } 14338 14339 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14340 int __b, 14341 vector unsigned short *__c) { 14342 return vec_stl( 14343 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14344 __b, __c); 14345 } 14346 14347 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 14348 vector bool short *__c) { 14349 return vec_stl( 14350 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14351 __b, __c); 14352 } 14353 14354 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 14355 vector pixel *__c) { 14356 return vec_stl( 14357 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14358 __b, __c); 14359 } 14360 14361 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14362 int *__c) { 14363 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14364 __c); 14365 } 14366 14367 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14368 vector int *__c) { 14369 return vec_stl( 14370 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14371 __b, __c); 14372 } 14373 14374 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14375 unsigned int *__c) { 14376 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14377 __c); 14378 } 14379 14380 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14381 vector unsigned int *__c) { 14382 return vec_stl( 14383 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14384 __b, __c); 14385 } 14386 14387 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 14388 vector bool int *__c) { 14389 return vec_stl( 14390 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14391 __b, __c); 14392 } 14393 14394 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 14395 vector float *__c) { 14396 return vec_stl( 14397 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14398 __b, __c); 14399 } 14400 14401 /* vec_stvrx */ 14402 14403 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14404 signed char *__c) { 14405 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14406 __c); 14407 } 14408 14409 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14410 vector signed char *__c) { 14411 return vec_st( 14412 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14413 __b, __c); 14414 } 14415 14416 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14417 unsigned char *__c) { 14418 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14419 __c); 14420 } 14421 14422 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14423 vector unsigned char *__c) { 14424 return vec_st( 14425 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14426 __b, __c); 14427 } 14428 14429 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 14430 vector bool char *__c) { 14431 return vec_st( 14432 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14433 __b, __c); 14434 } 14435 14436 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14437 short *__c) { 14438 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14439 __c); 14440 } 14441 14442 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14443 vector short *__c) { 14444 return vec_st( 14445 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14446 __b, __c); 14447 } 14448 14449 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14450 int __b, unsigned short *__c) { 14451 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14452 __c); 14453 } 14454 14455 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14456 int __b, 14457 vector unsigned short *__c) { 14458 return vec_st( 14459 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14460 __b, __c); 14461 } 14462 14463 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 14464 vector bool short *__c) { 14465 return vec_st( 14466 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14467 __b, __c); 14468 } 14469 14470 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 14471 vector pixel *__c) { 14472 return vec_st( 14473 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14474 __b, __c); 14475 } 14476 14477 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14478 int *__c) { 14479 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14480 __c); 14481 } 14482 14483 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14484 vector int *__c) { 14485 return vec_st( 14486 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14487 __b, __c); 14488 } 14489 14490 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14491 unsigned int *__c) { 14492 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14493 __c); 14494 } 14495 14496 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14497 vector unsigned int *__c) { 14498 return vec_st( 14499 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14500 __b, __c); 14501 } 14502 14503 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 14504 vector bool int *__c) { 14505 return vec_st( 14506 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14507 __b, __c); 14508 } 14509 14510 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 14511 vector float *__c) { 14512 return vec_st( 14513 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14514 __b, __c); 14515 } 14516 14517 /* vec_stvrxl */ 14518 14519 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14520 signed char *__c) { 14521 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14522 __c); 14523 } 14524 14525 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14526 vector signed char *__c) { 14527 return vec_stl( 14528 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14529 __b, __c); 14530 } 14531 14532 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14533 int __b, unsigned char *__c) { 14534 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14535 __c); 14536 } 14537 14538 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14539 int __b, 14540 vector unsigned char *__c) { 14541 return vec_stl( 14542 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14543 __b, __c); 14544 } 14545 14546 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 14547 vector bool char *__c) { 14548 return vec_stl( 14549 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14550 __b, __c); 14551 } 14552 14553 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14554 short *__c) { 14555 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14556 __c); 14557 } 14558 14559 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14560 vector short *__c) { 14561 return vec_stl( 14562 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14563 __b, __c); 14564 } 14565 14566 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14567 int __b, unsigned short *__c) { 14568 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14569 __c); 14570 } 14571 14572 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14573 int __b, 14574 vector unsigned short *__c) { 14575 return vec_stl( 14576 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14577 __b, __c); 14578 } 14579 14580 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 14581 vector bool short *__c) { 14582 return vec_stl( 14583 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14584 __b, __c); 14585 } 14586 14587 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 14588 vector pixel *__c) { 14589 return vec_stl( 14590 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14591 __b, __c); 14592 } 14593 14594 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14595 int *__c) { 14596 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14597 __c); 14598 } 14599 14600 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14601 vector int *__c) { 14602 return vec_stl( 14603 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14604 __b, __c); 14605 } 14606 14607 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14608 unsigned int *__c) { 14609 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14610 __c); 14611 } 14612 14613 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14614 vector unsigned int *__c) { 14615 return vec_stl( 14616 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14617 __b, __c); 14618 } 14619 14620 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 14621 vector bool int *__c) { 14622 return vec_stl( 14623 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14624 __b, __c); 14625 } 14626 14627 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 14628 vector float *__c) { 14629 return vec_stl( 14630 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14631 __b, __c); 14632 } 14633 14634 /* vec_promote */ 14635 14636 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 14637 int __b) { 14638 vector signed char __res = (vector signed char)(0); 14639 __res[__b & 0x7] = __a; 14640 return __res; 14641 } 14642 14643 static __inline__ vector unsigned char __ATTRS_o_ai 14644 vec_promote(unsigned char __a, int __b) { 14645 vector unsigned char __res = (vector unsigned char)(0); 14646 __res[__b & 0x7] = __a; 14647 return __res; 14648 } 14649 14650 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 14651 vector short __res = (vector short)(0); 14652 __res[__b & 0x7] = __a; 14653 return __res; 14654 } 14655 14656 static __inline__ vector unsigned short __ATTRS_o_ai 14657 vec_promote(unsigned short __a, int __b) { 14658 vector unsigned short __res = (vector unsigned short)(0); 14659 __res[__b & 0x7] = __a; 14660 return __res; 14661 } 14662 14663 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 14664 vector int __res = (vector int)(0); 14665 __res[__b & 0x3] = __a; 14666 return __res; 14667 } 14668 14669 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 14670 int __b) { 14671 vector unsigned int __res = (vector unsigned int)(0); 14672 __res[__b & 0x3] = __a; 14673 return __res; 14674 } 14675 14676 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 14677 vector float __res = (vector float)(0); 14678 __res[__b & 0x3] = __a; 14679 return __res; 14680 } 14681 14682 #ifdef __VSX__ 14683 static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) { 14684 vector double __res = (vector double)(0); 14685 __res[__b & 0x1] = __a; 14686 return __res; 14687 } 14688 14689 static __inline__ vector signed long long __ATTRS_o_ai 14690 vec_promote(signed long long __a, int __b) { 14691 vector signed long long __res = (vector signed long long)(0); 14692 __res[__b & 0x1] = __a; 14693 return __res; 14694 } 14695 14696 static __inline__ vector unsigned long long __ATTRS_o_ai 14697 vec_promote(unsigned long long __a, int __b) { 14698 vector unsigned long long __res = (vector unsigned long long)(0); 14699 __res[__b & 0x1] = __a; 14700 return __res; 14701 } 14702 #endif 14703 14704 /* vec_splats */ 14705 14706 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 14707 return (vector signed char)(__a); 14708 } 14709 14710 static __inline__ vector unsigned char __ATTRS_o_ai 14711 vec_splats(unsigned char __a) { 14712 return (vector unsigned char)(__a); 14713 } 14714 14715 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 14716 return (vector short)(__a); 14717 } 14718 14719 static __inline__ vector unsigned short __ATTRS_o_ai 14720 vec_splats(unsigned short __a) { 14721 return (vector unsigned short)(__a); 14722 } 14723 14724 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 14725 return (vector int)(__a); 14726 } 14727 14728 static __inline__ vector unsigned int __ATTRS_o_ai 14729 vec_splats(unsigned int __a) { 14730 return (vector unsigned int)(__a); 14731 } 14732 14733 #ifdef __VSX__ 14734 static __inline__ vector signed long long __ATTRS_o_ai 14735 vec_splats(signed long long __a) { 14736 return (vector signed long long)(__a); 14737 } 14738 14739 static __inline__ vector unsigned long long __ATTRS_o_ai 14740 vec_splats(unsigned long long __a) { 14741 return (vector unsigned long long)(__a); 14742 } 14743 14744 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 14745 defined(__SIZEOF_INT128__) 14746 static __inline__ vector signed __int128 __ATTRS_o_ai 14747 vec_splats(signed __int128 __a) { 14748 return (vector signed __int128)(__a); 14749 } 14750 14751 static __inline__ vector unsigned __int128 __ATTRS_o_ai 14752 vec_splats(unsigned __int128 __a) { 14753 return (vector unsigned __int128)(__a); 14754 } 14755 14756 #endif 14757 14758 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 14759 return (vector double)(__a); 14760 } 14761 #endif 14762 14763 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 14764 return (vector float)(__a); 14765 } 14766 14767 /* ----------------------------- predicates --------------------------------- */ 14768 14769 /* vec_all_eq */ 14770 14771 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14772 vector signed char __b) { 14773 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14774 (vector char)__b); 14775 } 14776 14777 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14778 vector bool char __b) { 14779 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14780 (vector char)__b); 14781 } 14782 14783 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14784 vector unsigned char __b) { 14785 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14786 (vector char)__b); 14787 } 14788 14789 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14790 vector bool char __b) { 14791 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14792 (vector char)__b); 14793 } 14794 14795 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14796 vector signed char __b) { 14797 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14798 (vector char)__b); 14799 } 14800 14801 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14802 vector unsigned char __b) { 14803 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14804 (vector char)__b); 14805 } 14806 14807 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14808 vector bool char __b) { 14809 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14810 (vector char)__b); 14811 } 14812 14813 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14814 vector short __b) { 14815 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 14816 } 14817 14818 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14819 vector bool short __b) { 14820 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 14821 } 14822 14823 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14824 vector unsigned short __b) { 14825 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14826 (vector short)__b); 14827 } 14828 14829 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14830 vector bool short __b) { 14831 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14832 (vector short)__b); 14833 } 14834 14835 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14836 vector short __b) { 14837 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14838 (vector short)__b); 14839 } 14840 14841 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14842 vector unsigned short __b) { 14843 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14844 (vector short)__b); 14845 } 14846 14847 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14848 vector bool short __b) { 14849 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14850 (vector short)__b); 14851 } 14852 14853 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 14854 vector pixel __b) { 14855 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14856 (vector short)__b); 14857 } 14858 14859 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 14860 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 14861 } 14862 14863 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 14864 vector bool int __b) { 14865 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 14866 } 14867 14868 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14869 vector unsigned int __b) { 14870 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14871 (vector int)__b); 14872 } 14873 14874 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14875 vector bool int __b) { 14876 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14877 (vector int)__b); 14878 } 14879 14880 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14881 vector int __b) { 14882 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14883 (vector int)__b); 14884 } 14885 14886 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14887 vector unsigned int __b) { 14888 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14889 (vector int)__b); 14890 } 14891 14892 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14893 vector bool int __b) { 14894 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14895 (vector int)__b); 14896 } 14897 14898 #ifdef __VSX__ 14899 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 14900 vector signed long long __b) { 14901 #ifdef __POWER8_VECTOR__ 14902 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 14903 #else 14904 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as 14905 // 32-bit elements. 14906 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0); 14907 #endif 14908 } 14909 14910 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 14911 vector bool long long __b) { 14912 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14913 } 14914 14915 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14916 vector unsigned long long __b) { 14917 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14918 } 14919 14920 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14921 vector bool long long __b) { 14922 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14923 } 14924 14925 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14926 vector long long __b) { 14927 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14928 } 14929 14930 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14931 vector unsigned long long __b) { 14932 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14933 } 14934 14935 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14936 vector bool long long __b) { 14937 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14938 } 14939 #endif 14940 14941 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 14942 vector float __b) { 14943 #ifdef __VSX__ 14944 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 14945 #else 14946 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 14947 #endif 14948 } 14949 14950 #ifdef __VSX__ 14951 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 14952 vector double __b) { 14953 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 14954 } 14955 #endif 14956 14957 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 14958 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, 14959 vector signed __int128 __b) { 14960 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a, 14961 (vector signed __int128)__b); 14962 } 14963 14964 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, 14965 vector unsigned __int128 __b) { 14966 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, 14967 (vector signed __int128)__b); 14968 } 14969 14970 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a, 14971 vector bool __int128 __b) { 14972 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a, 14973 (vector signed __int128)__b); 14974 } 14975 #endif 14976 14977 /* vec_all_ge */ 14978 14979 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14980 vector signed char __b) { 14981 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 14982 } 14983 14984 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14985 vector bool char __b) { 14986 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 14987 } 14988 14989 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14990 vector unsigned char __b) { 14991 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 14992 } 14993 14994 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14995 vector bool char __b) { 14996 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 14997 } 14998 14999 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 15000 vector signed char __b) { 15001 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a); 15002 } 15003 15004 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 15005 vector unsigned char __b) { 15006 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 15007 } 15008 15009 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 15010 vector bool char __b) { 15011 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 15012 (vector unsigned char)__a); 15013 } 15014 15015 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 15016 vector short __b) { 15017 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 15018 } 15019 15020 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 15021 vector bool short __b) { 15022 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 15023 } 15024 15025 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 15026 vector unsigned short __b) { 15027 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 15028 } 15029 15030 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 15031 vector bool short __b) { 15032 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 15033 __a); 15034 } 15035 15036 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 15037 vector short __b) { 15038 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a); 15039 } 15040 15041 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 15042 vector unsigned short __b) { 15043 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 15044 (vector unsigned short)__a); 15045 } 15046 15047 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 15048 vector bool short __b) { 15049 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 15050 (vector unsigned short)__a); 15051 } 15052 15053 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 15054 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 15055 } 15056 15057 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 15058 vector bool int __b) { 15059 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 15060 } 15061 15062 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 15063 vector unsigned int __b) { 15064 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 15065 } 15066 15067 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 15068 vector bool int __b) { 15069 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 15070 } 15071 15072 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15073 vector int __b) { 15074 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a); 15075 } 15076 15077 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15078 vector unsigned int __b) { 15079 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 15080 } 15081 15082 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15083 vector bool int __b) { 15084 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 15085 (vector unsigned int)__a); 15086 } 15087 15088 #ifdef __VSX__ 15089 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 15090 vector signed long long __b) { 15091 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 15092 } 15093 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 15094 vector bool long long __b) { 15095 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 15096 __a); 15097 } 15098 15099 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15100 vector unsigned long long __b) { 15101 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 15102 } 15103 15104 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15105 vector bool long long __b) { 15106 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15107 __a); 15108 } 15109 15110 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15111 vector signed long long __b) { 15112 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, 15113 (vector signed long long)__a); 15114 } 15115 15116 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15117 vector unsigned long long __b) { 15118 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 15119 (vector unsigned long long)__a); 15120 } 15121 15122 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15123 vector bool long long __b) { 15124 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15125 (vector unsigned long long)__a); 15126 } 15127 #endif 15128 15129 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 15130 vector float __b) { 15131 #ifdef __VSX__ 15132 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 15133 #else 15134 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 15135 #endif 15136 } 15137 15138 #ifdef __VSX__ 15139 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 15140 vector double __b) { 15141 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 15142 } 15143 #endif 15144 15145 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15146 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, 15147 vector signed __int128 __b) { 15148 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); 15149 } 15150 15151 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, 15152 vector unsigned __int128 __b) { 15153 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); 15154 } 15155 #endif 15156 15157 /* vec_all_gt */ 15158 15159 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15160 vector signed char __b) { 15161 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 15162 } 15163 15164 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15165 vector bool char __b) { 15166 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 15167 } 15168 15169 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15170 vector unsigned char __b) { 15171 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 15172 } 15173 15174 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15175 vector bool char __b) { 15176 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 15177 } 15178 15179 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15180 vector signed char __b) { 15181 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b); 15182 } 15183 15184 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15185 vector unsigned char __b) { 15186 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 15187 } 15188 15189 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15190 vector bool char __b) { 15191 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 15192 (vector unsigned char)__b); 15193 } 15194 15195 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15196 vector short __b) { 15197 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 15198 } 15199 15200 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15201 vector bool short __b) { 15202 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 15203 } 15204 15205 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15206 vector unsigned short __b) { 15207 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 15208 } 15209 15210 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15211 vector bool short __b) { 15212 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 15213 (vector unsigned short)__b); 15214 } 15215 15216 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15217 vector short __b) { 15218 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b); 15219 } 15220 15221 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15222 vector unsigned short __b) { 15223 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15224 __b); 15225 } 15226 15227 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15228 vector bool short __b) { 15229 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15230 (vector unsigned short)__b); 15231 } 15232 15233 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 15234 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 15235 } 15236 15237 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 15238 vector bool int __b) { 15239 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 15240 } 15241 15242 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15243 vector unsigned int __b) { 15244 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 15245 } 15246 15247 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15248 vector bool int __b) { 15249 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 15250 } 15251 15252 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15253 vector int __b) { 15254 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b); 15255 } 15256 15257 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15258 vector unsigned int __b) { 15259 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 15260 } 15261 15262 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15263 vector bool int __b) { 15264 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 15265 (vector unsigned int)__b); 15266 } 15267 15268 #ifdef __VSX__ 15269 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15270 vector signed long long __b) { 15271 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 15272 } 15273 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15274 vector bool long long __b) { 15275 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 15276 (vector signed long long)__b); 15277 } 15278 15279 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15280 vector unsigned long long __b) { 15281 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 15282 } 15283 15284 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15285 vector bool long long __b) { 15286 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 15287 (vector unsigned long long)__b); 15288 } 15289 15290 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15291 vector signed long long __b) { 15292 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a, 15293 __b); 15294 } 15295 15296 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15297 vector unsigned long long __b) { 15298 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15299 __b); 15300 } 15301 15302 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15303 vector bool long long __b) { 15304 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15305 (vector unsigned long long)__b); 15306 } 15307 #endif 15308 15309 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 15310 vector float __b) { 15311 #ifdef __VSX__ 15312 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 15313 #else 15314 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 15315 #endif 15316 } 15317 15318 #ifdef __VSX__ 15319 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 15320 vector double __b) { 15321 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 15322 } 15323 #endif 15324 15325 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15326 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, 15327 vector signed __int128 __b) { 15328 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); 15329 } 15330 15331 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, 15332 vector unsigned __int128 __b) { 15333 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); 15334 } 15335 #endif 15336 15337 /* vec_all_in */ 15338 15339 static __inline__ int __attribute__((__always_inline__)) 15340 vec_all_in(vector float __a, vector float __b) { 15341 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 15342 } 15343 15344 /* vec_all_le */ 15345 15346 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15347 vector signed char __b) { 15348 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 15349 } 15350 15351 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15352 vector bool char __b) { 15353 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 15354 } 15355 15356 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15357 vector unsigned char __b) { 15358 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 15359 } 15360 15361 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15362 vector bool char __b) { 15363 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 15364 } 15365 15366 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15367 vector signed char __b) { 15368 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b); 15369 } 15370 15371 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15372 vector unsigned char __b) { 15373 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 15374 } 15375 15376 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15377 vector bool char __b) { 15378 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 15379 (vector unsigned char)__b); 15380 } 15381 15382 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15383 vector short __b) { 15384 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 15385 } 15386 15387 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15388 vector bool short __b) { 15389 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 15390 } 15391 15392 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15393 vector unsigned short __b) { 15394 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 15395 } 15396 15397 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15398 vector bool short __b) { 15399 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 15400 (vector unsigned short)__b); 15401 } 15402 15403 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15404 vector short __b) { 15405 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b); 15406 } 15407 15408 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15409 vector unsigned short __b) { 15410 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15411 __b); 15412 } 15413 15414 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15415 vector bool short __b) { 15416 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15417 (vector unsigned short)__b); 15418 } 15419 15420 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 15421 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 15422 } 15423 15424 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 15425 vector bool int __b) { 15426 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 15427 } 15428 15429 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15430 vector unsigned int __b) { 15431 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 15432 } 15433 15434 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15435 vector bool int __b) { 15436 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 15437 } 15438 15439 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15440 vector int __b) { 15441 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b); 15442 } 15443 15444 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15445 vector unsigned int __b) { 15446 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 15447 } 15448 15449 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15450 vector bool int __b) { 15451 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 15452 (vector unsigned int)__b); 15453 } 15454 15455 #ifdef __VSX__ 15456 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15457 vector signed long long __b) { 15458 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 15459 } 15460 15461 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15462 vector unsigned long long __b) { 15463 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 15464 } 15465 15466 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15467 vector bool long long __b) { 15468 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 15469 (vector signed long long)__b); 15470 } 15471 15472 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15473 vector bool long long __b) { 15474 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 15475 (vector unsigned long long)__b); 15476 } 15477 15478 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15479 vector signed long long __b) { 15480 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a, 15481 __b); 15482 } 15483 15484 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15485 vector unsigned long long __b) { 15486 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15487 __b); 15488 } 15489 15490 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15491 vector bool long long __b) { 15492 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15493 (vector unsigned long long)__b); 15494 } 15495 #endif 15496 15497 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 15498 vector float __b) { 15499 #ifdef __VSX__ 15500 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 15501 #else 15502 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 15503 #endif 15504 } 15505 15506 #ifdef __VSX__ 15507 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 15508 vector double __b) { 15509 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 15510 } 15511 #endif 15512 15513 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15514 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, 15515 vector signed __int128 __b) { 15516 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); 15517 } 15518 15519 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, 15520 vector unsigned __int128 __b) { 15521 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); 15522 } 15523 #endif 15524 15525 /* vec_all_lt */ 15526 15527 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15528 vector signed char __b) { 15529 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 15530 } 15531 15532 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15533 vector bool char __b) { 15534 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 15535 } 15536 15537 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15538 vector unsigned char __b) { 15539 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 15540 } 15541 15542 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15543 vector bool char __b) { 15544 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 15545 } 15546 15547 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15548 vector signed char __b) { 15549 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a); 15550 } 15551 15552 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15553 vector unsigned char __b) { 15554 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 15555 } 15556 15557 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15558 vector bool char __b) { 15559 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 15560 (vector unsigned char)__a); 15561 } 15562 15563 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15564 vector short __b) { 15565 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 15566 } 15567 15568 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15569 vector bool short __b) { 15570 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 15571 } 15572 15573 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15574 vector unsigned short __b) { 15575 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 15576 } 15577 15578 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15579 vector bool short __b) { 15580 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15581 __a); 15582 } 15583 15584 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15585 vector short __b) { 15586 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a); 15587 } 15588 15589 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15590 vector unsigned short __b) { 15591 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 15592 (vector unsigned short)__a); 15593 } 15594 15595 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15596 vector bool short __b) { 15597 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15598 (vector unsigned short)__a); 15599 } 15600 15601 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 15602 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 15603 } 15604 15605 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 15606 vector bool int __b) { 15607 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 15608 } 15609 15610 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15611 vector unsigned int __b) { 15612 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 15613 } 15614 15615 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15616 vector bool int __b) { 15617 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 15618 } 15619 15620 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15621 vector int __b) { 15622 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a); 15623 } 15624 15625 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15626 vector unsigned int __b) { 15627 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 15628 } 15629 15630 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15631 vector bool int __b) { 15632 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 15633 (vector unsigned int)__a); 15634 } 15635 15636 #ifdef __VSX__ 15637 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15638 vector signed long long __b) { 15639 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 15640 } 15641 15642 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15643 vector unsigned long long __b) { 15644 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 15645 } 15646 15647 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15648 vector bool long long __b) { 15649 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 15650 __a); 15651 } 15652 15653 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15654 vector bool long long __b) { 15655 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15656 __a); 15657 } 15658 15659 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15660 vector signed long long __b) { 15661 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, 15662 (vector signed long long)__a); 15663 } 15664 15665 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15666 vector unsigned long long __b) { 15667 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 15668 (vector unsigned long long)__a); 15669 } 15670 15671 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15672 vector bool long long __b) { 15673 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15674 (vector unsigned long long)__a); 15675 } 15676 #endif 15677 15678 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 15679 vector float __b) { 15680 #ifdef __VSX__ 15681 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 15682 #else 15683 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 15684 #endif 15685 } 15686 15687 #ifdef __VSX__ 15688 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 15689 vector double __b) { 15690 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 15691 } 15692 #endif 15693 15694 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15695 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a, 15696 vector signed __int128 __b) { 15697 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a); 15698 } 15699 15700 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a, 15701 vector unsigned __int128 __b) { 15702 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a); 15703 } 15704 #endif 15705 15706 /* vec_all_nan */ 15707 15708 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 15709 #ifdef __VSX__ 15710 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 15711 #else 15712 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 15713 #endif 15714 } 15715 15716 #ifdef __VSX__ 15717 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 15718 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 15719 } 15720 #endif 15721 15722 /* vec_all_ne */ 15723 15724 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15725 vector signed char __b) { 15726 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15727 (vector char)__b); 15728 } 15729 15730 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15731 vector bool char __b) { 15732 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15733 (vector char)__b); 15734 } 15735 15736 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15737 vector unsigned char __b) { 15738 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15739 (vector char)__b); 15740 } 15741 15742 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15743 vector bool char __b) { 15744 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15745 (vector char)__b); 15746 } 15747 15748 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15749 vector signed char __b) { 15750 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15751 (vector char)__b); 15752 } 15753 15754 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15755 vector unsigned char __b) { 15756 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15757 (vector char)__b); 15758 } 15759 15760 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15761 vector bool char __b) { 15762 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15763 (vector char)__b); 15764 } 15765 15766 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15767 vector short __b) { 15768 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 15769 } 15770 15771 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15772 vector bool short __b) { 15773 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 15774 } 15775 15776 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15777 vector unsigned short __b) { 15778 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15779 (vector short)__b); 15780 } 15781 15782 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15783 vector bool short __b) { 15784 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15785 (vector short)__b); 15786 } 15787 15788 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15789 vector short __b) { 15790 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15791 (vector short)__b); 15792 } 15793 15794 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15795 vector unsigned short __b) { 15796 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15797 (vector short)__b); 15798 } 15799 15800 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15801 vector bool short __b) { 15802 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15803 (vector short)__b); 15804 } 15805 15806 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 15807 vector pixel __b) { 15808 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15809 (vector short)__b); 15810 } 15811 15812 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 15813 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 15814 } 15815 15816 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 15817 vector bool int __b) { 15818 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 15819 } 15820 15821 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15822 vector unsigned int __b) { 15823 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15824 (vector int)__b); 15825 } 15826 15827 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15828 vector bool int __b) { 15829 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15830 (vector int)__b); 15831 } 15832 15833 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15834 vector int __b) { 15835 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15836 (vector int)__b); 15837 } 15838 15839 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15840 vector unsigned int __b) { 15841 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15842 (vector int)__b); 15843 } 15844 15845 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15846 vector bool int __b) { 15847 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15848 (vector int)__b); 15849 } 15850 15851 #ifdef __VSX__ 15852 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15853 vector signed long long __b) { 15854 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 15855 } 15856 15857 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15858 vector unsigned long long __b) { 15859 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 15860 (vector long long)__b); 15861 } 15862 15863 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15864 vector bool long long __b) { 15865 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 15866 (vector signed long long)__b); 15867 } 15868 15869 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15870 vector bool long long __b) { 15871 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15872 (vector signed long long)__b); 15873 } 15874 15875 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15876 vector signed long long __b) { 15877 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15878 (vector signed long long)__b); 15879 } 15880 15881 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15882 vector unsigned long long __b) { 15883 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15884 (vector signed long long)__b); 15885 } 15886 15887 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15888 vector bool long long __b) { 15889 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15890 (vector signed long long)__b); 15891 } 15892 #endif 15893 15894 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 15895 vector float __b) { 15896 #ifdef __VSX__ 15897 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); 15898 #else 15899 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 15900 #endif 15901 } 15902 15903 #ifdef __VSX__ 15904 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 15905 vector double __b) { 15906 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 15907 } 15908 #endif 15909 15910 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15911 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a, 15912 vector signed __int128 __b) { 15913 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a, 15914 __b); 15915 } 15916 15917 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a, 15918 vector unsigned __int128 __b) { 15919 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, 15920 (vector signed __int128)__b); 15921 } 15922 15923 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a, 15924 vector bool __int128 __b) { 15925 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a, 15926 (vector signed __int128)__b); 15927 } 15928 #endif 15929 15930 /* vec_all_nge */ 15931 15932 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 15933 vector float __b) { 15934 #ifdef __VSX__ 15935 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 15936 #else 15937 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 15938 #endif 15939 } 15940 15941 #ifdef __VSX__ 15942 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 15943 vector double __b) { 15944 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 15945 } 15946 #endif 15947 15948 /* vec_all_ngt */ 15949 15950 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 15951 vector float __b) { 15952 #ifdef __VSX__ 15953 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 15954 #else 15955 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 15956 #endif 15957 } 15958 15959 #ifdef __VSX__ 15960 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 15961 vector double __b) { 15962 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 15963 } 15964 #endif 15965 15966 /* vec_all_nle */ 15967 15968 static __inline__ int __ATTRS_o_ai 15969 vec_all_nle(vector float __a, vector float __b) { 15970 #ifdef __VSX__ 15971 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a); 15972 #else 15973 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 15974 #endif 15975 } 15976 15977 #ifdef __VSX__ 15978 static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a, 15979 vector double __b) { 15980 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a); 15981 } 15982 #endif 15983 15984 /* vec_all_nlt */ 15985 15986 static __inline__ int __ATTRS_o_ai 15987 vec_all_nlt(vector float __a, vector float __b) { 15988 #ifdef __VSX__ 15989 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a); 15990 #else 15991 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 15992 #endif 15993 } 15994 15995 #ifdef __VSX__ 15996 static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a, 15997 vector double __b) { 15998 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a); 15999 } 16000 #endif 16001 16002 /* vec_all_numeric */ 16003 16004 static __inline__ int __ATTRS_o_ai 16005 vec_all_numeric(vector float __a) { 16006 #ifdef __VSX__ 16007 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a); 16008 #else 16009 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 16010 #endif 16011 } 16012 16013 #ifdef __VSX__ 16014 static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) { 16015 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a); 16016 } 16017 #endif 16018 16019 /* vec_any_eq */ 16020 16021 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 16022 vector signed char __b) { 16023 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16024 (vector char)__b); 16025 } 16026 16027 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 16028 vector bool char __b) { 16029 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16030 (vector char)__b); 16031 } 16032 16033 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 16034 vector unsigned char __b) { 16035 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16036 (vector char)__b); 16037 } 16038 16039 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 16040 vector bool char __b) { 16041 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16042 (vector char)__b); 16043 } 16044 16045 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 16046 vector signed char __b) { 16047 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16048 (vector char)__b); 16049 } 16050 16051 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 16052 vector unsigned char __b) { 16053 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16054 (vector char)__b); 16055 } 16056 16057 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 16058 vector bool char __b) { 16059 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 16060 (vector char)__b); 16061 } 16062 16063 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 16064 vector short __b) { 16065 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 16066 } 16067 16068 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 16069 vector bool short __b) { 16070 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 16071 } 16072 16073 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 16074 vector unsigned short __b) { 16075 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16076 (vector short)__b); 16077 } 16078 16079 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 16080 vector bool short __b) { 16081 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16082 (vector short)__b); 16083 } 16084 16085 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16086 vector short __b) { 16087 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16088 (vector short)__b); 16089 } 16090 16091 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16092 vector unsigned short __b) { 16093 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16094 (vector short)__b); 16095 } 16096 16097 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16098 vector bool short __b) { 16099 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16100 (vector short)__b); 16101 } 16102 16103 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 16104 vector pixel __b) { 16105 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16106 (vector short)__b); 16107 } 16108 16109 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 16110 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 16111 } 16112 16113 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 16114 vector bool int __b) { 16115 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 16116 } 16117 16118 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16119 vector unsigned int __b) { 16120 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16121 (vector int)__b); 16122 } 16123 16124 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16125 vector bool int __b) { 16126 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16127 (vector int)__b); 16128 } 16129 16130 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16131 vector int __b) { 16132 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16133 (vector int)__b); 16134 } 16135 16136 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16137 vector unsigned int __b) { 16138 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16139 (vector int)__b); 16140 } 16141 16142 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16143 vector bool int __b) { 16144 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16145 (vector int)__b); 16146 } 16147 16148 #ifdef __VSX__ 16149 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16150 vector signed long long __b) { 16151 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 16152 } 16153 16154 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16155 vector unsigned long long __b) { 16156 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 16157 (vector long long)__b); 16158 } 16159 16160 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16161 vector bool long long __b) { 16162 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 16163 (vector signed long long)__b); 16164 } 16165 16166 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16167 vector bool long long __b) { 16168 return __builtin_altivec_vcmpequd_p( 16169 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16170 } 16171 16172 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16173 vector signed long long __b) { 16174 return __builtin_altivec_vcmpequd_p( 16175 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16176 } 16177 16178 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16179 vector unsigned long long __b) { 16180 return __builtin_altivec_vcmpequd_p( 16181 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16182 } 16183 16184 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16185 vector bool long long __b) { 16186 return __builtin_altivec_vcmpequd_p( 16187 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16188 } 16189 #endif 16190 16191 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 16192 vector float __b) { 16193 #ifdef __VSX__ 16194 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 16195 #else 16196 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 16197 #endif 16198 } 16199 16200 #ifdef __VSX__ 16201 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 16202 vector double __b) { 16203 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 16204 } 16205 #endif 16206 16207 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16208 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a, 16209 vector signed __int128 __b) { 16210 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, 16211 (vector unsigned __int128)__a, __b); 16212 } 16213 16214 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a, 16215 vector unsigned __int128 __b) { 16216 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, 16217 (vector signed __int128)__b); 16218 } 16219 16220 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a, 16221 vector bool __int128 __b) { 16222 return __builtin_altivec_vcmpequq_p( 16223 __CR6_EQ_REV, (vector unsigned __int128)__a, (vector signed __int128)__b); 16224 } 16225 #endif 16226 16227 /* vec_any_ge */ 16228 16229 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16230 vector signed char __b) { 16231 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 16232 } 16233 16234 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16235 vector bool char __b) { 16236 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 16237 __a); 16238 } 16239 16240 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16241 vector unsigned char __b) { 16242 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 16243 } 16244 16245 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16246 vector bool char __b) { 16247 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16248 __a); 16249 } 16250 16251 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16252 vector signed char __b) { 16253 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, 16254 (vector signed char)__a); 16255 } 16256 16257 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16258 vector unsigned char __b) { 16259 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 16260 (vector unsigned char)__a); 16261 } 16262 16263 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16264 vector bool char __b) { 16265 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16266 (vector unsigned char)__a); 16267 } 16268 16269 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16270 vector short __b) { 16271 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 16272 } 16273 16274 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16275 vector bool short __b) { 16276 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 16277 } 16278 16279 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16280 vector unsigned short __b) { 16281 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 16282 } 16283 16284 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16285 vector bool short __b) { 16286 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16287 __a); 16288 } 16289 16290 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16291 vector short __b) { 16292 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, 16293 (vector signed short)__a); 16294 } 16295 16296 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16297 vector unsigned short __b) { 16298 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 16299 (vector unsigned short)__a); 16300 } 16301 16302 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16303 vector bool short __b) { 16304 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16305 (vector unsigned short)__a); 16306 } 16307 16308 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 16309 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 16310 } 16311 16312 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 16313 vector bool int __b) { 16314 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 16315 } 16316 16317 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16318 vector unsigned int __b) { 16319 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 16320 } 16321 16322 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16323 vector bool int __b) { 16324 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16325 __a); 16326 } 16327 16328 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16329 vector int __b) { 16330 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, 16331 (vector signed int)__a); 16332 } 16333 16334 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16335 vector unsigned int __b) { 16336 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 16337 (vector unsigned int)__a); 16338 } 16339 16340 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16341 vector bool int __b) { 16342 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16343 (vector unsigned int)__a); 16344 } 16345 16346 #ifdef __VSX__ 16347 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16348 vector signed long long __b) { 16349 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 16350 } 16351 16352 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16353 vector unsigned long long __b) { 16354 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 16355 } 16356 16357 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16358 vector bool long long __b) { 16359 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16360 (vector signed long long)__b, __a); 16361 } 16362 16363 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16364 vector bool long long __b) { 16365 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16366 (vector unsigned long long)__b, __a); 16367 } 16368 16369 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16370 vector signed long long __b) { 16371 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, 16372 (vector signed long long)__a); 16373 } 16374 16375 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16376 vector unsigned long long __b) { 16377 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 16378 (vector unsigned long long)__a); 16379 } 16380 16381 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16382 vector bool long long __b) { 16383 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16384 (vector unsigned long long)__b, 16385 (vector unsigned long long)__a); 16386 } 16387 #endif 16388 16389 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 16390 vector float __b) { 16391 #ifdef __VSX__ 16392 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 16393 #else 16394 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 16395 #endif 16396 } 16397 16398 #ifdef __VSX__ 16399 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 16400 vector double __b) { 16401 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 16402 } 16403 #endif 16404 16405 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16406 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, 16407 vector signed __int128 __b) { 16408 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); 16409 } 16410 16411 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, 16412 vector unsigned __int128 __b) { 16413 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); 16414 } 16415 #endif 16416 16417 /* vec_any_gt */ 16418 16419 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16420 vector signed char __b) { 16421 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 16422 } 16423 16424 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16425 vector bool char __b) { 16426 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 16427 (vector signed char)__b); 16428 } 16429 16430 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16431 vector unsigned char __b) { 16432 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 16433 } 16434 16435 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16436 vector bool char __b) { 16437 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 16438 (vector unsigned char)__b); 16439 } 16440 16441 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16442 vector signed char __b) { 16443 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a, 16444 __b); 16445 } 16446 16447 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16448 vector unsigned char __b) { 16449 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16450 __b); 16451 } 16452 16453 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16454 vector bool char __b) { 16455 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16456 (vector unsigned char)__b); 16457 } 16458 16459 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16460 vector short __b) { 16461 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 16462 } 16463 16464 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16465 vector bool short __b) { 16466 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 16467 } 16468 16469 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16470 vector unsigned short __b) { 16471 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 16472 } 16473 16474 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16475 vector bool short __b) { 16476 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 16477 (vector unsigned short)__b); 16478 } 16479 16480 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16481 vector short __b) { 16482 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a, 16483 __b); 16484 } 16485 16486 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16487 vector unsigned short __b) { 16488 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16489 __b); 16490 } 16491 16492 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16493 vector bool short __b) { 16494 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16495 (vector unsigned short)__b); 16496 } 16497 16498 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 16499 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 16500 } 16501 16502 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 16503 vector bool int __b) { 16504 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 16505 } 16506 16507 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16508 vector unsigned int __b) { 16509 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 16510 } 16511 16512 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16513 vector bool int __b) { 16514 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 16515 (vector unsigned int)__b); 16516 } 16517 16518 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16519 vector int __b) { 16520 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a, 16521 __b); 16522 } 16523 16524 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16525 vector unsigned int __b) { 16526 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16527 __b); 16528 } 16529 16530 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16531 vector bool int __b) { 16532 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16533 (vector unsigned int)__b); 16534 } 16535 16536 #ifdef __VSX__ 16537 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16538 vector signed long long __b) { 16539 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 16540 } 16541 16542 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16543 vector unsigned long long __b) { 16544 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 16545 } 16546 16547 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16548 vector bool long long __b) { 16549 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 16550 (vector signed long long)__b); 16551 } 16552 16553 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16554 vector bool long long __b) { 16555 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 16556 (vector unsigned long long)__b); 16557 } 16558 16559 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16560 vector signed long long __b) { 16561 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16562 (vector signed long long)__a, __b); 16563 } 16564 16565 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16566 vector unsigned long long __b) { 16567 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16568 (vector unsigned long long)__a, __b); 16569 } 16570 16571 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16572 vector bool long long __b) { 16573 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16574 (vector unsigned long long)__a, 16575 (vector unsigned long long)__b); 16576 } 16577 #endif 16578 16579 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 16580 vector float __b) { 16581 #ifdef __VSX__ 16582 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 16583 #else 16584 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 16585 #endif 16586 } 16587 16588 #ifdef __VSX__ 16589 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 16590 vector double __b) { 16591 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 16592 } 16593 #endif 16594 16595 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16596 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, 16597 vector signed __int128 __b) { 16598 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); 16599 } 16600 16601 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, 16602 vector unsigned __int128 __b) { 16603 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); 16604 } 16605 #endif 16606 16607 /* vec_any_le */ 16608 16609 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16610 vector signed char __b) { 16611 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 16612 } 16613 16614 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16615 vector bool char __b) { 16616 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 16617 (vector signed char)__b); 16618 } 16619 16620 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16621 vector unsigned char __b) { 16622 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 16623 } 16624 16625 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16626 vector bool char __b) { 16627 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 16628 (vector unsigned char)__b); 16629 } 16630 16631 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16632 vector signed char __b) { 16633 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a, 16634 __b); 16635 } 16636 16637 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16638 vector unsigned char __b) { 16639 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16640 __b); 16641 } 16642 16643 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16644 vector bool char __b) { 16645 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16646 (vector unsigned char)__b); 16647 } 16648 16649 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16650 vector short __b) { 16651 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 16652 } 16653 16654 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16655 vector bool short __b) { 16656 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 16657 } 16658 16659 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16660 vector unsigned short __b) { 16661 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 16662 } 16663 16664 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16665 vector bool short __b) { 16666 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 16667 (vector unsigned short)__b); 16668 } 16669 16670 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16671 vector short __b) { 16672 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a, 16673 __b); 16674 } 16675 16676 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16677 vector unsigned short __b) { 16678 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16679 __b); 16680 } 16681 16682 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16683 vector bool short __b) { 16684 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16685 (vector unsigned short)__b); 16686 } 16687 16688 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 16689 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 16690 } 16691 16692 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 16693 vector bool int __b) { 16694 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 16695 } 16696 16697 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16698 vector unsigned int __b) { 16699 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 16700 } 16701 16702 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16703 vector bool int __b) { 16704 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 16705 (vector unsigned int)__b); 16706 } 16707 16708 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16709 vector int __b) { 16710 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a, 16711 __b); 16712 } 16713 16714 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16715 vector unsigned int __b) { 16716 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16717 __b); 16718 } 16719 16720 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16721 vector bool int __b) { 16722 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16723 (vector unsigned int)__b); 16724 } 16725 16726 #ifdef __VSX__ 16727 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16728 vector signed long long __b) { 16729 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 16730 } 16731 16732 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16733 vector unsigned long long __b) { 16734 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 16735 } 16736 16737 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16738 vector bool long long __b) { 16739 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 16740 (vector signed long long)__b); 16741 } 16742 16743 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16744 vector bool long long __b) { 16745 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 16746 (vector unsigned long long)__b); 16747 } 16748 16749 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16750 vector signed long long __b) { 16751 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16752 (vector signed long long)__a, __b); 16753 } 16754 16755 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16756 vector unsigned long long __b) { 16757 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16758 (vector unsigned long long)__a, __b); 16759 } 16760 16761 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16762 vector bool long long __b) { 16763 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16764 (vector unsigned long long)__a, 16765 (vector unsigned long long)__b); 16766 } 16767 #endif 16768 16769 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 16770 vector float __b) { 16771 #ifdef __VSX__ 16772 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 16773 #else 16774 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 16775 #endif 16776 } 16777 16778 #ifdef __VSX__ 16779 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 16780 vector double __b) { 16781 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 16782 } 16783 #endif 16784 16785 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16786 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, 16787 vector signed __int128 __b) { 16788 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); 16789 } 16790 16791 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, 16792 vector unsigned __int128 __b) { 16793 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); 16794 } 16795 #endif 16796 16797 /* vec_any_lt */ 16798 16799 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16800 vector signed char __b) { 16801 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 16802 } 16803 16804 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16805 vector bool char __b) { 16806 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 16807 __a); 16808 } 16809 16810 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16811 vector unsigned char __b) { 16812 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 16813 } 16814 16815 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16816 vector bool char __b) { 16817 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16818 __a); 16819 } 16820 16821 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16822 vector signed char __b) { 16823 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, 16824 (vector signed char)__a); 16825 } 16826 16827 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16828 vector unsigned char __b) { 16829 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 16830 (vector unsigned char)__a); 16831 } 16832 16833 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16834 vector bool char __b) { 16835 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16836 (vector unsigned char)__a); 16837 } 16838 16839 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16840 vector short __b) { 16841 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 16842 } 16843 16844 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16845 vector bool short __b) { 16846 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 16847 } 16848 16849 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16850 vector unsigned short __b) { 16851 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 16852 } 16853 16854 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16855 vector bool short __b) { 16856 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16857 __a); 16858 } 16859 16860 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16861 vector short __b) { 16862 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, 16863 (vector signed short)__a); 16864 } 16865 16866 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16867 vector unsigned short __b) { 16868 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 16869 (vector unsigned short)__a); 16870 } 16871 16872 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16873 vector bool short __b) { 16874 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16875 (vector unsigned short)__a); 16876 } 16877 16878 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 16879 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 16880 } 16881 16882 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 16883 vector bool int __b) { 16884 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 16885 } 16886 16887 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16888 vector unsigned int __b) { 16889 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 16890 } 16891 16892 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16893 vector bool int __b) { 16894 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16895 __a); 16896 } 16897 16898 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16899 vector int __b) { 16900 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, 16901 (vector signed int)__a); 16902 } 16903 16904 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16905 vector unsigned int __b) { 16906 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 16907 (vector unsigned int)__a); 16908 } 16909 16910 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16911 vector bool int __b) { 16912 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16913 (vector unsigned int)__a); 16914 } 16915 16916 #ifdef __VSX__ 16917 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16918 vector signed long long __b) { 16919 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 16920 } 16921 16922 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16923 vector unsigned long long __b) { 16924 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 16925 } 16926 16927 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16928 vector bool long long __b) { 16929 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16930 (vector signed long long)__b, __a); 16931 } 16932 16933 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16934 vector bool long long __b) { 16935 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16936 (vector unsigned long long)__b, __a); 16937 } 16938 16939 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16940 vector signed long long __b) { 16941 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, 16942 (vector signed long long)__a); 16943 } 16944 16945 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16946 vector unsigned long long __b) { 16947 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 16948 (vector unsigned long long)__a); 16949 } 16950 16951 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16952 vector bool long long __b) { 16953 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16954 (vector unsigned long long)__b, 16955 (vector unsigned long long)__a); 16956 } 16957 #endif 16958 16959 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 16960 vector float __b) { 16961 #ifdef __VSX__ 16962 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 16963 #else 16964 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 16965 #endif 16966 } 16967 16968 #ifdef __VSX__ 16969 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 16970 vector double __b) { 16971 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 16972 } 16973 #endif 16974 16975 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16976 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, 16977 vector signed __int128 __b) { 16978 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); 16979 } 16980 16981 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, 16982 vector unsigned __int128 __b) { 16983 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); 16984 } 16985 #endif 16986 16987 /* vec_any_nan */ 16988 16989 static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) { 16990 #ifdef __VSX__ 16991 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a); 16992 #else 16993 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 16994 #endif 16995 } 16996 #ifdef __VSX__ 16997 static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) { 16998 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a); 16999 } 17000 #endif 17001 17002 /* vec_any_ne */ 17003 17004 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 17005 vector signed char __b) { 17006 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17007 (vector char)__b); 17008 } 17009 17010 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 17011 vector bool char __b) { 17012 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17013 (vector char)__b); 17014 } 17015 17016 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 17017 vector unsigned char __b) { 17018 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17019 (vector char)__b); 17020 } 17021 17022 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 17023 vector bool char __b) { 17024 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17025 (vector char)__b); 17026 } 17027 17028 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 17029 vector signed char __b) { 17030 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17031 (vector char)__b); 17032 } 17033 17034 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 17035 vector unsigned char __b) { 17036 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17037 (vector char)__b); 17038 } 17039 17040 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 17041 vector bool char __b) { 17042 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 17043 (vector char)__b); 17044 } 17045 17046 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 17047 vector short __b) { 17048 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 17049 } 17050 17051 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 17052 vector bool short __b) { 17053 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 17054 } 17055 17056 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 17057 vector unsigned short __b) { 17058 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17059 (vector short)__b); 17060 } 17061 17062 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 17063 vector bool short __b) { 17064 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17065 (vector short)__b); 17066 } 17067 17068 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17069 vector short __b) { 17070 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17071 (vector short)__b); 17072 } 17073 17074 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17075 vector unsigned short __b) { 17076 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17077 (vector short)__b); 17078 } 17079 17080 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17081 vector bool short __b) { 17082 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17083 (vector short)__b); 17084 } 17085 17086 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 17087 vector pixel __b) { 17088 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17089 (vector short)__b); 17090 } 17091 17092 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 17093 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 17094 } 17095 17096 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 17097 vector bool int __b) { 17098 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 17099 } 17100 17101 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17102 vector unsigned int __b) { 17103 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17104 (vector int)__b); 17105 } 17106 17107 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17108 vector bool int __b) { 17109 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17110 (vector int)__b); 17111 } 17112 17113 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17114 vector int __b) { 17115 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17116 (vector int)__b); 17117 } 17118 17119 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17120 vector unsigned int __b) { 17121 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17122 (vector int)__b); 17123 } 17124 17125 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17126 vector bool int __b) { 17127 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17128 (vector int)__b); 17129 } 17130 17131 #ifdef __VSX__ 17132 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17133 vector signed long long __b) { 17134 #ifdef __POWER8_VECTOR__ 17135 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 17136 #else 17137 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is 17138 // not available. 17139 return !vec_all_eq(__a, __b); 17140 #endif 17141 } 17142 17143 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17144 vector unsigned long long __b) { 17145 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17146 } 17147 17148 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17149 vector bool long long __b) { 17150 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17151 } 17152 17153 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17154 vector bool long long __b) { 17155 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17156 } 17157 17158 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17159 vector signed long long __b) { 17160 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17161 } 17162 17163 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17164 vector unsigned long long __b) { 17165 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17166 } 17167 17168 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17169 vector bool long long __b) { 17170 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17171 } 17172 #endif 17173 17174 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 17175 vector float __b) { 17176 #ifdef __VSX__ 17177 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 17178 #else 17179 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 17180 #endif 17181 } 17182 17183 #ifdef __VSX__ 17184 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 17185 vector double __b) { 17186 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 17187 } 17188 #endif 17189 17190 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 17191 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, 17192 vector signed __int128 __b) { 17193 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, 17194 (vector unsigned __int128)__a, __b); 17195 } 17196 17197 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, 17198 vector unsigned __int128 __b) { 17199 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, 17200 (vector signed __int128)__b); 17201 } 17202 17203 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a, 17204 vector bool __int128 __b) { 17205 return __builtin_altivec_vcmpequq_p( 17206 __CR6_LT_REV, (vector unsigned __int128)__a, (vector signed __int128)__b); 17207 } 17208 #endif 17209 17210 /* vec_any_nge */ 17211 17212 static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, 17213 vector float __b) { 17214 #ifdef __VSX__ 17215 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b); 17216 #else 17217 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 17218 #endif 17219 } 17220 17221 #ifdef __VSX__ 17222 static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a, 17223 vector double __b) { 17224 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b); 17225 } 17226 #endif 17227 17228 /* vec_any_ngt */ 17229 17230 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, 17231 vector float __b) { 17232 #ifdef __VSX__ 17233 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b); 17234 #else 17235 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 17236 #endif 17237 } 17238 17239 #ifdef __VSX__ 17240 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a, 17241 vector double __b) { 17242 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b); 17243 } 17244 #endif 17245 17246 /* vec_any_nle */ 17247 17248 static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, 17249 vector float __b) { 17250 #ifdef __VSX__ 17251 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a); 17252 #else 17253 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 17254 #endif 17255 } 17256 17257 #ifdef __VSX__ 17258 static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a, 17259 vector double __b) { 17260 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a); 17261 } 17262 #endif 17263 17264 /* vec_any_nlt */ 17265 17266 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, 17267 vector float __b) { 17268 #ifdef __VSX__ 17269 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a); 17270 #else 17271 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 17272 #endif 17273 } 17274 17275 #ifdef __VSX__ 17276 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a, 17277 vector double __b) { 17278 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a); 17279 } 17280 #endif 17281 17282 /* vec_any_numeric */ 17283 17284 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) { 17285 #ifdef __VSX__ 17286 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a); 17287 #else 17288 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 17289 #endif 17290 } 17291 17292 #ifdef __VSX__ 17293 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) { 17294 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a); 17295 } 17296 #endif 17297 17298 /* vec_any_out */ 17299 17300 static __inline__ int __attribute__((__always_inline__)) 17301 vec_any_out(vector float __a, vector float __b) { 17302 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 17303 } 17304 17305 /* Power 8 Crypto functions 17306 Note: We diverge from the current GCC implementation with regard 17307 to cryptography and related functions as follows: 17308 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 17309 - The remaining ones are only available on Power8 and up so 17310 require -mpower8-vector 17311 The justification for this is that export requirements require that 17312 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 17313 support). As a result, we need to be able to turn off support for those. 17314 The remaining ones (currently controlled by -mcrypto for GCC) still 17315 need to be provided on compliant hardware even if Vector.Crypto is not 17316 provided. 17317 */ 17318 #ifdef __CRYPTO__ 17319 #define vec_sbox_be __builtin_altivec_crypto_vsbox 17320 #define vec_cipher_be __builtin_altivec_crypto_vcipher 17321 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 17322 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 17323 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 17324 17325 #ifdef __VSX__ 17326 static __inline__ vector unsigned char __attribute__((__always_inline__)) 17327 __builtin_crypto_vsbox(vector unsigned char __a) { 17328 return __builtin_altivec_crypto_vsbox(__a); 17329 } 17330 17331 static __inline__ vector unsigned char __attribute__((__always_inline__)) 17332 __builtin_crypto_vcipher(vector unsigned char __a, 17333 vector unsigned char __b) { 17334 return __builtin_altivec_crypto_vcipher(__a, __b); 17335 } 17336 17337 static __inline__ vector unsigned char __attribute__((__always_inline__)) 17338 __builtin_crypto_vcipherlast(vector unsigned char __a, 17339 vector unsigned char __b) { 17340 return __builtin_altivec_crypto_vcipherlast(__a, __b); 17341 } 17342 17343 static __inline__ vector unsigned char __attribute__((__always_inline__)) 17344 __builtin_crypto_vncipher(vector unsigned char __a, 17345 vector unsigned char __b) { 17346 return __builtin_altivec_crypto_vncipher(__a, __b); 17347 } 17348 17349 static __inline__ vector unsigned char __attribute__((__always_inline__)) 17350 __builtin_crypto_vncipherlast(vector unsigned char __a, 17351 vector unsigned char __b) { 17352 return __builtin_altivec_crypto_vncipherlast(__a, __b); 17353 } 17354 #endif /* __VSX__ */ 17355 17356 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 17357 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 17358 17359 #define vec_shasigma_be(X, Y, Z) \ 17360 _Generic((X), vector unsigned int \ 17361 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 17362 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 17363 #endif 17364 17365 #ifdef __POWER8_VECTOR__ 17366 static __inline__ vector bool char __ATTRS_o_ai 17367 vec_permxor(vector bool char __a, vector bool char __b, 17368 vector bool char __c) { 17369 return (vector bool char)__builtin_altivec_crypto_vpermxor( 17370 (vector unsigned char)__a, (vector unsigned char)__b, 17371 (vector unsigned char)__c); 17372 } 17373 17374 static __inline__ vector signed char __ATTRS_o_ai 17375 vec_permxor(vector signed char __a, vector signed char __b, 17376 vector signed char __c) { 17377 return (vector signed char)__builtin_altivec_crypto_vpermxor( 17378 (vector unsigned char)__a, (vector unsigned char)__b, 17379 (vector unsigned char)__c); 17380 } 17381 17382 static __inline__ vector unsigned char __ATTRS_o_ai 17383 vec_permxor(vector unsigned char __a, vector unsigned char __b, 17384 vector unsigned char __c) { 17385 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17386 } 17387 17388 static __inline__ vector unsigned char __ATTRS_o_ai 17389 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 17390 vector unsigned char __c) { 17391 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17392 } 17393 17394 static __inline__ vector unsigned short __ATTRS_o_ai 17395 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 17396 vector unsigned short __c) { 17397 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 17398 (vector unsigned char)__a, (vector unsigned char)__b, 17399 (vector unsigned char)__c); 17400 } 17401 17402 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 17403 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 17404 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 17405 (vector unsigned char)__a, (vector unsigned char)__b, 17406 (vector unsigned char)__c); 17407 } 17408 17409 static __inline__ vector unsigned long long __ATTRS_o_ai 17410 __builtin_crypto_vpermxor(vector unsigned long long __a, 17411 vector unsigned long long __b, 17412 vector unsigned long long __c) { 17413 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 17414 (vector unsigned char)__a, (vector unsigned char)__b, 17415 (vector unsigned char)__c); 17416 } 17417 17418 static __inline__ vector unsigned char __ATTRS_o_ai 17419 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 17420 return __builtin_altivec_crypto_vpmsumb(__a, __b); 17421 } 17422 17423 static __inline__ vector unsigned short __ATTRS_o_ai 17424 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 17425 return __builtin_altivec_crypto_vpmsumh(__a, __b); 17426 } 17427 17428 static __inline__ vector unsigned int __ATTRS_o_ai 17429 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 17430 return __builtin_altivec_crypto_vpmsumw(__a, __b); 17431 } 17432 17433 static __inline__ vector unsigned long long __ATTRS_o_ai 17434 __builtin_crypto_vpmsumb(vector unsigned long long __a, 17435 vector unsigned long long __b) { 17436 return __builtin_altivec_crypto_vpmsumd(__a, __b); 17437 } 17438 17439 static __inline__ vector signed char __ATTRS_o_ai 17440 vec_vgbbd(vector signed char __a) { 17441 return (vector signed char)__builtin_altivec_vgbbd((vector unsigned char)__a); 17442 } 17443 17444 #define vec_pmsum_be __builtin_crypto_vpmsumb 17445 #define vec_gb __builtin_altivec_vgbbd 17446 17447 static __inline__ vector unsigned char __ATTRS_o_ai 17448 vec_vgbbd(vector unsigned char __a) { 17449 return __builtin_altivec_vgbbd(__a); 17450 } 17451 17452 static __inline__ vector signed long long __ATTRS_o_ai 17453 vec_gbb(vector signed long long __a) { 17454 return (vector signed long long)__builtin_altivec_vgbbd( 17455 (vector unsigned char)__a); 17456 } 17457 17458 static __inline__ vector unsigned long long __ATTRS_o_ai 17459 vec_gbb(vector unsigned long long __a) { 17460 return (vector unsigned long long)__builtin_altivec_vgbbd( 17461 (vector unsigned char)__a); 17462 } 17463 17464 static __inline__ vector long long __ATTRS_o_ai 17465 vec_vbpermq(vector signed char __a, vector signed char __b) { 17466 return (vector long long)__builtin_altivec_vbpermq((vector unsigned char)__a, 17467 (vector unsigned char)__b); 17468 } 17469 17470 static __inline__ vector long long __ATTRS_o_ai 17471 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 17472 return (vector long long)__builtin_altivec_vbpermq(__a, __b); 17473 } 17474 17475 #if defined(__powerpc64__) && defined(__SIZEOF_INT128__) 17476 static __inline__ vector unsigned long long __ATTRS_o_ai 17477 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 17478 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17479 (vector unsigned char)__b); 17480 } 17481 #endif 17482 static __inline__ vector unsigned char __ATTRS_o_ai 17483 vec_bperm(vector unsigned char __a, vector unsigned char __b) { 17484 return (vector unsigned char)__builtin_altivec_vbpermq(__a, __b); 17485 } 17486 #endif // __POWER8_VECTOR__ 17487 #ifdef __POWER9_VECTOR__ 17488 static __inline__ vector unsigned long long __ATTRS_o_ai 17489 vec_bperm(vector unsigned long long __a, vector unsigned char __b) { 17490 return __builtin_altivec_vbpermd(__a, __b); 17491 } 17492 #endif 17493 17494 17495 /* vec_reve */ 17496 17497 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 17498 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17499 5, 4, 3, 2, 1, 0); 17500 } 17501 17502 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 17503 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17504 5, 4, 3, 2, 1, 0); 17505 } 17506 17507 static inline __ATTRS_o_ai vector unsigned char 17508 vec_reve(vector unsigned char __a) { 17509 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17510 5, 4, 3, 2, 1, 0); 17511 } 17512 17513 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 17514 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17515 } 17516 17517 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 17518 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17519 } 17520 17521 static inline __ATTRS_o_ai vector unsigned int 17522 vec_reve(vector unsigned int __a) { 17523 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17524 } 17525 17526 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 17527 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17528 } 17529 17530 static inline __ATTRS_o_ai vector signed short 17531 vec_reve(vector signed short __a) { 17532 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17533 } 17534 17535 static inline __ATTRS_o_ai vector unsigned short 17536 vec_reve(vector unsigned short __a) { 17537 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17538 } 17539 17540 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 17541 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17542 } 17543 17544 #ifdef __VSX__ 17545 static inline __ATTRS_o_ai vector bool long long 17546 vec_reve(vector bool long long __a) { 17547 return __builtin_shufflevector(__a, __a, 1, 0); 17548 } 17549 17550 static inline __ATTRS_o_ai vector signed long long 17551 vec_reve(vector signed long long __a) { 17552 return __builtin_shufflevector(__a, __a, 1, 0); 17553 } 17554 17555 static inline __ATTRS_o_ai vector unsigned long long 17556 vec_reve(vector unsigned long long __a) { 17557 return __builtin_shufflevector(__a, __a, 1, 0); 17558 } 17559 17560 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 17561 return __builtin_shufflevector(__a, __a, 1, 0); 17562 } 17563 #endif 17564 17565 /* vec_revb */ 17566 static __inline__ vector bool char __ATTRS_o_ai 17567 vec_revb(vector bool char __a) { 17568 return __a; 17569 } 17570 17571 static __inline__ vector signed char __ATTRS_o_ai 17572 vec_revb(vector signed char __a) { 17573 return __a; 17574 } 17575 17576 static __inline__ vector unsigned char __ATTRS_o_ai 17577 vec_revb(vector unsigned char __a) { 17578 return __a; 17579 } 17580 17581 static __inline__ vector bool short __ATTRS_o_ai 17582 vec_revb(vector bool short __a) { 17583 vector unsigned char __indices = 17584 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17585 return vec_perm(__a, __a, __indices); 17586 } 17587 17588 static __inline__ vector signed short __ATTRS_o_ai 17589 vec_revb(vector signed short __a) { 17590 vector unsigned char __indices = 17591 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17592 return vec_perm(__a, __a, __indices); 17593 } 17594 17595 static __inline__ vector unsigned short __ATTRS_o_ai 17596 vec_revb(vector unsigned short __a) { 17597 vector unsigned char __indices = 17598 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17599 return vec_perm(__a, __a, __indices); 17600 } 17601 17602 static __inline__ vector bool int __ATTRS_o_ai 17603 vec_revb(vector bool int __a) { 17604 vector unsigned char __indices = 17605 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17606 return vec_perm(__a, __a, __indices); 17607 } 17608 17609 static __inline__ vector signed int __ATTRS_o_ai 17610 vec_revb(vector signed int __a) { 17611 vector unsigned char __indices = 17612 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17613 return vec_perm(__a, __a, __indices); 17614 } 17615 17616 static __inline__ vector unsigned int __ATTRS_o_ai 17617 vec_revb(vector unsigned int __a) { 17618 vector unsigned char __indices = 17619 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17620 return vec_perm(__a, __a, __indices); 17621 } 17622 17623 static __inline__ vector float __ATTRS_o_ai 17624 vec_revb(vector float __a) { 17625 vector unsigned char __indices = 17626 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17627 return vec_perm(__a, __a, __indices); 17628 } 17629 17630 #ifdef __VSX__ 17631 static __inline__ vector bool long long __ATTRS_o_ai 17632 vec_revb(vector bool long long __a) { 17633 vector unsigned char __indices = 17634 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17635 return vec_perm(__a, __a, __indices); 17636 } 17637 17638 static __inline__ vector signed long long __ATTRS_o_ai 17639 vec_revb(vector signed long long __a) { 17640 vector unsigned char __indices = 17641 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17642 return vec_perm(__a, __a, __indices); 17643 } 17644 17645 static __inline__ vector unsigned long long __ATTRS_o_ai 17646 vec_revb(vector unsigned long long __a) { 17647 vector unsigned char __indices = 17648 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17649 return vec_perm(__a, __a, __indices); 17650 } 17651 17652 static __inline__ vector double __ATTRS_o_ai 17653 vec_revb(vector double __a) { 17654 vector unsigned char __indices = 17655 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17656 return vec_perm(__a, __a, __indices); 17657 } 17658 #endif /* End __VSX__ */ 17659 17660 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17661 defined(__SIZEOF_INT128__) 17662 static __inline__ vector signed __int128 __ATTRS_o_ai 17663 vec_revb(vector signed __int128 __a) { 17664 vector unsigned char __indices = 17665 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17666 return (vector signed __int128)vec_perm((vector signed int)__a, 17667 (vector signed int)__a, 17668 __indices); 17669 } 17670 17671 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17672 vec_revb(vector unsigned __int128 __a) { 17673 vector unsigned char __indices = 17674 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17675 return (vector unsigned __int128)vec_perm((vector signed int)__a, 17676 (vector signed int)__a, 17677 __indices); 17678 } 17679 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 17680 17681 /* vec_xl */ 17682 17683 #define vec_xld2 vec_xl 17684 #define vec_xlw4 vec_xl 17685 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 17686 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 17687 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 17688 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 17689 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 17690 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 17691 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 17692 17693 static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, 17694 const signed char *__ptr) { 17695 return *(unaligned_vec_schar *)(__ptr + __offset); 17696 } 17697 17698 static inline __ATTRS_o_ai vector unsigned char 17699 vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) { 17700 return *(unaligned_vec_uchar*)(__ptr + __offset); 17701 } 17702 17703 static inline __ATTRS_o_ai vector signed short 17704 vec_xl(ptrdiff_t __offset, const signed short *__ptr) { 17705 signed char *__addr = (signed char *)__ptr + __offset; 17706 return *(unaligned_vec_sshort *)__addr; 17707 } 17708 17709 static inline __ATTRS_o_ai vector unsigned short 17710 vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) { 17711 signed char *__addr = (signed char *)__ptr + __offset; 17712 return *(unaligned_vec_ushort *)__addr; 17713 } 17714 17715 static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset, 17716 const signed int *__ptr) { 17717 signed char *__addr = (signed char *)__ptr + __offset; 17718 return *(unaligned_vec_sint *)__addr; 17719 } 17720 17721 static inline __ATTRS_o_ai vector unsigned int 17722 vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) { 17723 signed char *__addr = (signed char *)__ptr + __offset; 17724 return *(unaligned_vec_uint *)__addr; 17725 } 17726 17727 static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset, 17728 const float *__ptr) { 17729 signed char *__addr = (signed char *)__ptr + __offset; 17730 return *(unaligned_vec_float *)__addr; 17731 } 17732 17733 #ifdef __VSX__ 17734 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 17735 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 17736 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 17737 17738 static inline __ATTRS_o_ai vector signed long long 17739 vec_xl(ptrdiff_t __offset, const signed long long *__ptr) { 17740 signed char *__addr = (signed char *)__ptr + __offset; 17741 return *(unaligned_vec_sll *)__addr; 17742 } 17743 17744 static inline __ATTRS_o_ai vector unsigned long long 17745 vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) { 17746 signed char *__addr = (signed char *)__ptr + __offset; 17747 return *(unaligned_vec_ull *)__addr; 17748 } 17749 17750 static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset, 17751 const double *__ptr) { 17752 signed char *__addr = (signed char *)__ptr + __offset; 17753 return *(unaligned_vec_double *)__addr; 17754 } 17755 #endif 17756 17757 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17758 defined(__SIZEOF_INT128__) 17759 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 17760 typedef vector unsigned __int128 unaligned_vec_ui128 17761 __attribute__((aligned(1))); 17762 static inline __ATTRS_o_ai vector signed __int128 17763 vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) { 17764 signed char *__addr = (signed char *)__ptr + __offset; 17765 return *(unaligned_vec_si128 *)__addr; 17766 } 17767 17768 static inline __ATTRS_o_ai vector unsigned __int128 17769 vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) { 17770 signed char *__addr = (signed char *)__ptr + __offset; 17771 return *(unaligned_vec_ui128 *)__addr; 17772 } 17773 #endif 17774 17775 /* vec_xl_be */ 17776 17777 #ifdef __LITTLE_ENDIAN__ 17778 static __inline__ vector signed char __ATTRS_o_ai 17779 vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) { 17780 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17781 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17782 13, 12, 11, 10, 9, 8); 17783 } 17784 17785 static __inline__ vector unsigned char __ATTRS_o_ai 17786 vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) { 17787 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17788 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17789 13, 12, 11, 10, 9, 8); 17790 } 17791 17792 static __inline__ vector signed short __ATTRS_o_ai 17793 vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) { 17794 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17795 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17796 } 17797 17798 static __inline__ vector unsigned short __ATTRS_o_ai 17799 vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) { 17800 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17801 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17802 } 17803 17804 static __inline__ vector signed int __ATTRS_o_ai 17805 vec_xl_be(signed long long __offset, const signed int *__ptr) { 17806 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17807 } 17808 17809 static __inline__ vector unsigned int __ATTRS_o_ai 17810 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 17811 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17812 } 17813 17814 static __inline__ vector float __ATTRS_o_ai 17815 vec_xl_be(signed long long __offset, const float *__ptr) { 17816 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17817 } 17818 17819 #ifdef __VSX__ 17820 static __inline__ vector signed long long __ATTRS_o_ai 17821 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 17822 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17823 } 17824 17825 static __inline__ vector unsigned long long __ATTRS_o_ai 17826 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 17827 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17828 } 17829 17830 static __inline__ vector double __ATTRS_o_ai 17831 vec_xl_be(signed long long __offset, const double *__ptr) { 17832 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17833 } 17834 #endif 17835 17836 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17837 defined(__SIZEOF_INT128__) 17838 static __inline__ vector signed __int128 __ATTRS_o_ai 17839 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 17840 return vec_xl(__offset, __ptr); 17841 } 17842 17843 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17844 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 17845 return vec_xl(__offset, __ptr); 17846 } 17847 #endif 17848 #else 17849 #define vec_xl_be vec_xl 17850 #endif 17851 17852 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17853 defined(__SIZEOF_INT128__) 17854 17855 /* vec_xl_sext */ 17856 17857 static __inline__ vector signed __int128 __ATTRS_o_ai 17858 vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) { 17859 return (vector signed __int128)*(__pointer + __offset); 17860 } 17861 17862 static __inline__ vector signed __int128 __ATTRS_o_ai 17863 vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) { 17864 return (vector signed __int128)*(__pointer + __offset); 17865 } 17866 17867 static __inline__ vector signed __int128 __ATTRS_o_ai 17868 vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) { 17869 return (vector signed __int128)*(__pointer + __offset); 17870 } 17871 17872 static __inline__ vector signed __int128 __ATTRS_o_ai 17873 vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) { 17874 return (vector signed __int128)*(__pointer + __offset); 17875 } 17876 17877 /* vec_xl_zext */ 17878 17879 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17880 vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) { 17881 return (vector unsigned __int128)*(__pointer + __offset); 17882 } 17883 17884 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17885 vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) { 17886 return (vector unsigned __int128)*(__pointer + __offset); 17887 } 17888 17889 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17890 vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) { 17891 return (vector unsigned __int128)*(__pointer + __offset); 17892 } 17893 17894 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17895 vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) { 17896 return (vector unsigned __int128)*(__pointer + __offset); 17897 } 17898 17899 #endif 17900 17901 /* vec_xlds */ 17902 #ifdef __VSX__ 17903 static __inline__ vector signed long long __ATTRS_o_ai 17904 vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) { 17905 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset); 17906 return (vector signed long long) *__addr; 17907 } 17908 17909 static __inline__ vector unsigned long long __ATTRS_o_ai 17910 vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) { 17911 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset); 17912 return (unaligned_vec_ull) *__addr; 17913 } 17914 17915 static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset, 17916 const double *__ptr) { 17917 double *__addr = (double*)((signed char *)__ptr + __offset); 17918 return (unaligned_vec_double) *__addr; 17919 } 17920 17921 /* vec_load_splats */ 17922 static __inline__ vector signed int __ATTRS_o_ai 17923 vec_load_splats(signed long long __offset, const signed int *__ptr) { 17924 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17925 return (vector signed int)*__addr; 17926 } 17927 17928 static __inline__ vector signed int __ATTRS_o_ai 17929 vec_load_splats(unsigned long long __offset, const signed int *__ptr) { 17930 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17931 return (vector signed int)*__addr; 17932 } 17933 17934 static __inline__ vector unsigned int __ATTRS_o_ai 17935 vec_load_splats(signed long long __offset, const unsigned int *__ptr) { 17936 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17937 return (vector unsigned int)*__addr; 17938 } 17939 17940 static __inline__ vector unsigned int __ATTRS_o_ai 17941 vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) { 17942 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17943 return (vector unsigned int)*__addr; 17944 } 17945 17946 static __inline__ vector float __ATTRS_o_ai 17947 vec_load_splats(signed long long __offset, const float *__ptr) { 17948 float *__addr = (float*)((signed char *)__ptr + __offset); 17949 return (vector float)*__addr; 17950 } 17951 17952 static __inline__ vector float __ATTRS_o_ai 17953 vec_load_splats(unsigned long long __offset, const float *__ptr) { 17954 float *__addr = (float*)((signed char *)__ptr + __offset); 17955 return (vector float)*__addr; 17956 } 17957 #endif 17958 17959 /* vec_xst */ 17960 17961 #define vec_xstd2 vec_xst 17962 #define vec_xstw4 vec_xst 17963 static inline __ATTRS_o_ai void 17964 vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) { 17965 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 17966 } 17967 17968 static inline __ATTRS_o_ai void 17969 vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) { 17970 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 17971 } 17972 17973 static inline __ATTRS_o_ai void 17974 vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) { 17975 signed char *__addr = (signed char *)__ptr + __offset; 17976 *(unaligned_vec_sshort *)__addr = __vec; 17977 } 17978 17979 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 17980 ptrdiff_t __offset, 17981 unsigned short *__ptr) { 17982 signed char *__addr = (signed char *)__ptr + __offset; 17983 *(unaligned_vec_ushort *)__addr = __vec; 17984 } 17985 17986 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 17987 ptrdiff_t __offset, signed int *__ptr) { 17988 signed char *__addr = (signed char *)__ptr + __offset; 17989 *(unaligned_vec_sint *)__addr = __vec; 17990 } 17991 17992 static inline __ATTRS_o_ai void 17993 vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) { 17994 signed char *__addr = (signed char *)__ptr + __offset; 17995 *(unaligned_vec_uint *)__addr = __vec; 17996 } 17997 17998 static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset, 17999 float *__ptr) { 18000 signed char *__addr = (signed char *)__ptr + __offset; 18001 *(unaligned_vec_float *)__addr = __vec; 18002 } 18003 18004 #ifdef __VSX__ 18005 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 18006 ptrdiff_t __offset, 18007 signed long long *__ptr) { 18008 signed char *__addr = (signed char *)__ptr + __offset; 18009 *(unaligned_vec_sll *)__addr = __vec; 18010 } 18011 18012 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 18013 ptrdiff_t __offset, 18014 unsigned long long *__ptr) { 18015 signed char *__addr = (signed char *)__ptr + __offset; 18016 *(unaligned_vec_ull *)__addr = __vec; 18017 } 18018 18019 static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset, 18020 double *__ptr) { 18021 signed char *__addr = (signed char *)__ptr + __offset; 18022 *(unaligned_vec_double *)__addr = __vec; 18023 } 18024 #endif 18025 18026 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 18027 defined(__SIZEOF_INT128__) 18028 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 18029 ptrdiff_t __offset, 18030 signed __int128 *__ptr) { 18031 signed char *__addr = (signed char *)__ptr + __offset; 18032 *(unaligned_vec_si128 *)__addr = __vec; 18033 } 18034 18035 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 18036 ptrdiff_t __offset, 18037 unsigned __int128 *__ptr) { 18038 signed char *__addr = (signed char *)__ptr + __offset; 18039 *(unaligned_vec_ui128 *)__addr = __vec; 18040 } 18041 #endif 18042 18043 /* vec_xst_trunc */ 18044 18045 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 18046 defined(__SIZEOF_INT128__) 18047 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 18048 ptrdiff_t __offset, 18049 signed char *__ptr) { 18050 *(__ptr + __offset) = (signed char)__vec[0]; 18051 } 18052 18053 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18054 ptrdiff_t __offset, 18055 unsigned char *__ptr) { 18056 *(__ptr + __offset) = (unsigned char)__vec[0]; 18057 } 18058 18059 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 18060 ptrdiff_t __offset, 18061 signed short *__ptr) { 18062 *(__ptr + __offset) = (signed short)__vec[0]; 18063 } 18064 18065 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18066 ptrdiff_t __offset, 18067 unsigned short *__ptr) { 18068 *(__ptr + __offset) = (unsigned short)__vec[0]; 18069 } 18070 18071 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 18072 ptrdiff_t __offset, 18073 signed int *__ptr) { 18074 *(__ptr + __offset) = (signed int)__vec[0]; 18075 } 18076 18077 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18078 ptrdiff_t __offset, 18079 unsigned int *__ptr) { 18080 *(__ptr + __offset) = (unsigned int)__vec[0]; 18081 } 18082 18083 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 18084 ptrdiff_t __offset, 18085 signed long long *__ptr) { 18086 *(__ptr + __offset) = (signed long long)__vec[0]; 18087 } 18088 18089 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18090 ptrdiff_t __offset, 18091 unsigned long long *__ptr) { 18092 *(__ptr + __offset) = (unsigned long long)__vec[0]; 18093 } 18094 #endif 18095 18096 /* vec_xst_be */ 18097 18098 #ifdef __LITTLE_ENDIAN__ 18099 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 18100 signed long long __offset, 18101 signed char *__ptr) { 18102 vector signed char __tmp = 18103 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 18104 13, 12, 11, 10, 9, 8); 18105 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18106 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18107 } 18108 18109 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 18110 signed long long __offset, 18111 unsigned char *__ptr) { 18112 vector unsigned char __tmp = 18113 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 18114 13, 12, 11, 10, 9, 8); 18115 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18116 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18117 } 18118 18119 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 18120 signed long long __offset, 18121 signed short *__ptr) { 18122 vector signed short __tmp = 18123 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18124 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18125 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18126 } 18127 18128 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 18129 signed long long __offset, 18130 unsigned short *__ptr) { 18131 vector unsigned short __tmp = 18132 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18133 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18134 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18135 } 18136 18137 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 18138 signed long long __offset, 18139 signed int *__ptr) { 18140 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 18141 } 18142 18143 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 18144 signed long long __offset, 18145 unsigned int *__ptr) { 18146 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18147 } 18148 18149 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 18150 signed long long __offset, 18151 float *__ptr) { 18152 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18153 } 18154 18155 #ifdef __VSX__ 18156 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 18157 signed long long __offset, 18158 signed long long *__ptr) { 18159 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18160 } 18161 18162 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 18163 signed long long __offset, 18164 unsigned long long *__ptr) { 18165 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18166 } 18167 18168 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 18169 signed long long __offset, 18170 double *__ptr) { 18171 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18172 } 18173 #endif 18174 18175 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 18176 defined(__SIZEOF_INT128__) 18177 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 18178 signed long long __offset, 18179 signed __int128 *__ptr) { 18180 vec_xst(__vec, __offset, __ptr); 18181 } 18182 18183 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 18184 signed long long __offset, 18185 unsigned __int128 *__ptr) { 18186 vec_xst(__vec, __offset, __ptr); 18187 } 18188 #endif 18189 #else 18190 #define vec_xst_be vec_xst 18191 #endif 18192 18193 #ifdef __POWER9_VECTOR__ 18194 #define vec_test_data_class(__a, __b) \ 18195 _Generic( \ 18196 (__a), vector float \ 18197 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 18198 vector double \ 18199 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 18200 (__b))) 18201 18202 #endif /* #ifdef __POWER9_VECTOR__ */ 18203 18204 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 18205 return -__a; 18206 } 18207 18208 #ifdef __VSX__ 18209 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 18210 return -__a; 18211 } 18212 18213 #endif 18214 18215 #ifdef __VSX__ 18216 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 18217 return -__a; 18218 } 18219 #endif 18220 18221 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 18222 return -__a; 18223 } 18224 18225 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 18226 return -__a; 18227 } 18228 18229 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 18230 return -__a; 18231 } 18232 18233 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 18234 return - vec_abs(__a); 18235 } 18236 18237 #ifdef __VSX__ 18238 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 18239 return - vec_abs(__a); 18240 } 18241 18242 #endif 18243 18244 #ifdef __POWER8_VECTOR__ 18245 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 18246 return __builtin_altivec_vminsd(__a, -__a); 18247 } 18248 #endif 18249 18250 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 18251 return __builtin_altivec_vminsw(__a, -__a); 18252 } 18253 18254 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 18255 return __builtin_altivec_vminsh(__a, -__a); 18256 } 18257 18258 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 18259 return __builtin_altivec_vminsb(__a, -__a); 18260 } 18261 18262 static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, 18263 vector float __b) { 18264 return __builtin_ppc_recipdivf(__a, __b); 18265 } 18266 18267 #ifdef __VSX__ 18268 static vector double __ATTRS_o_ai vec_recipdiv(vector double __a, 18269 vector double __b) { 18270 return __builtin_ppc_recipdivd(__a, __b); 18271 } 18272 #endif 18273 18274 #ifdef __POWER10_VECTOR__ 18275 18276 /* vec_extractm */ 18277 18278 static __inline__ unsigned int __ATTRS_o_ai 18279 vec_extractm(vector unsigned char __a) { 18280 return __builtin_altivec_vextractbm(__a); 18281 } 18282 18283 static __inline__ unsigned int __ATTRS_o_ai 18284 vec_extractm(vector unsigned short __a) { 18285 return __builtin_altivec_vextracthm(__a); 18286 } 18287 18288 static __inline__ unsigned int __ATTRS_o_ai 18289 vec_extractm(vector unsigned int __a) { 18290 return __builtin_altivec_vextractwm(__a); 18291 } 18292 18293 static __inline__ unsigned int __ATTRS_o_ai 18294 vec_extractm(vector unsigned long long __a) { 18295 return __builtin_altivec_vextractdm(__a); 18296 } 18297 18298 #ifdef __SIZEOF_INT128__ 18299 static __inline__ unsigned int __ATTRS_o_ai 18300 vec_extractm(vector unsigned __int128 __a) { 18301 return __builtin_altivec_vextractqm(__a); 18302 } 18303 #endif 18304 18305 /* vec_expandm */ 18306 18307 static __inline__ vector unsigned char __ATTRS_o_ai 18308 vec_expandm(vector unsigned char __a) { 18309 return __builtin_altivec_vexpandbm(__a); 18310 } 18311 18312 static __inline__ vector unsigned short __ATTRS_o_ai 18313 vec_expandm(vector unsigned short __a) { 18314 return __builtin_altivec_vexpandhm(__a); 18315 } 18316 18317 static __inline__ vector unsigned int __ATTRS_o_ai 18318 vec_expandm(vector unsigned int __a) { 18319 return __builtin_altivec_vexpandwm(__a); 18320 } 18321 18322 static __inline__ vector unsigned long long __ATTRS_o_ai 18323 vec_expandm(vector unsigned long long __a) { 18324 return __builtin_altivec_vexpanddm(__a); 18325 } 18326 18327 #ifdef __SIZEOF_INT128__ 18328 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18329 vec_expandm(vector unsigned __int128 __a) { 18330 return __builtin_altivec_vexpandqm(__a); 18331 } 18332 #endif 18333 18334 /* vec_cntm */ 18335 18336 #define vec_cntm(__a, __mp) \ 18337 _Generic((__a), vector unsigned char \ 18338 : __builtin_altivec_vcntmbb((vector unsigned char)(__a), \ 18339 (unsigned char)(__mp)), \ 18340 vector unsigned short \ 18341 : __builtin_altivec_vcntmbh((vector unsigned short)(__a), \ 18342 (unsigned char)(__mp)), \ 18343 vector unsigned int \ 18344 : __builtin_altivec_vcntmbw((vector unsigned int)(__a), \ 18345 (unsigned char)(__mp)), \ 18346 vector unsigned long long \ 18347 : __builtin_altivec_vcntmbd((vector unsigned long long)(__a), \ 18348 (unsigned char)(__mp))) 18349 18350 /* vec_gen[b|h|w|d|q]m */ 18351 18352 static __inline__ vector unsigned char __ATTRS_o_ai 18353 vec_genbm(unsigned long long __bm) { 18354 return __builtin_altivec_mtvsrbm(__bm); 18355 } 18356 18357 static __inline__ vector unsigned short __ATTRS_o_ai 18358 vec_genhm(unsigned long long __bm) { 18359 return __builtin_altivec_mtvsrhm(__bm); 18360 } 18361 18362 static __inline__ vector unsigned int __ATTRS_o_ai 18363 vec_genwm(unsigned long long __bm) { 18364 return __builtin_altivec_mtvsrwm(__bm); 18365 } 18366 18367 static __inline__ vector unsigned long long __ATTRS_o_ai 18368 vec_gendm(unsigned long long __bm) { 18369 return __builtin_altivec_mtvsrdm(__bm); 18370 } 18371 18372 #ifdef __SIZEOF_INT128__ 18373 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18374 vec_genqm(unsigned long long __bm) { 18375 return __builtin_altivec_mtvsrqm(__bm); 18376 } 18377 #endif 18378 18379 /* vec_pdep */ 18380 18381 static __inline__ vector unsigned long long __ATTRS_o_ai 18382 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 18383 return __builtin_altivec_vpdepd(__a, __b); 18384 } 18385 18386 /* vec_pext */ 18387 18388 static __inline__ vector unsigned long long __ATTRS_o_ai 18389 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 18390 return __builtin_altivec_vpextd(__a, __b); 18391 } 18392 18393 /* vec_cfuge */ 18394 18395 static __inline__ vector unsigned long long __ATTRS_o_ai 18396 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 18397 return __builtin_altivec_vcfuged(__a, __b); 18398 } 18399 18400 /* vec_gnb */ 18401 18402 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 18403 18404 /* vec_ternarylogic */ 18405 #ifdef __VSX__ 18406 #ifdef __SIZEOF_INT128__ 18407 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18408 _Generic((__a), vector unsigned char \ 18409 : (vector unsigned char)__builtin_vsx_xxeval( \ 18410 (vector unsigned long long)(__a), \ 18411 (vector unsigned long long)(__b), \ 18412 (vector unsigned long long)(__c), (__imm)), \ 18413 vector unsigned short \ 18414 : (vector unsigned short)__builtin_vsx_xxeval( \ 18415 (vector unsigned long long)(__a), \ 18416 (vector unsigned long long)(__b), \ 18417 (vector unsigned long long)(__c), (__imm)), \ 18418 vector unsigned int \ 18419 : (vector unsigned int)__builtin_vsx_xxeval( \ 18420 (vector unsigned long long)(__a), \ 18421 (vector unsigned long long)(__b), \ 18422 (vector unsigned long long)(__c), (__imm)), \ 18423 vector unsigned long long \ 18424 : (vector unsigned long long)__builtin_vsx_xxeval( \ 18425 (vector unsigned long long)(__a), \ 18426 (vector unsigned long long)(__b), \ 18427 (vector unsigned long long)(__c), (__imm)), \ 18428 vector unsigned __int128 \ 18429 : (vector unsigned __int128)__builtin_vsx_xxeval( \ 18430 (vector unsigned long long)(__a), \ 18431 (vector unsigned long long)(__b), \ 18432 (vector unsigned long long)(__c), (__imm))) 18433 #else 18434 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18435 _Generic((__a), vector unsigned char \ 18436 : (vector unsigned char)__builtin_vsx_xxeval( \ 18437 (vector unsigned long long)(__a), \ 18438 (vector unsigned long long)(__b), \ 18439 (vector unsigned long long)(__c), (__imm)), \ 18440 vector unsigned short \ 18441 : (vector unsigned short)__builtin_vsx_xxeval( \ 18442 (vector unsigned long long)(__a), \ 18443 (vector unsigned long long)(__b), \ 18444 (vector unsigned long long)(__c), (__imm)), \ 18445 vector unsigned int \ 18446 : (vector unsigned int)__builtin_vsx_xxeval( \ 18447 (vector unsigned long long)(__a), \ 18448 (vector unsigned long long)(__b), \ 18449 (vector unsigned long long)(__c), (__imm)), \ 18450 vector unsigned long long \ 18451 : (vector unsigned long long)__builtin_vsx_xxeval( \ 18452 (vector unsigned long long)(__a), \ 18453 (vector unsigned long long)(__b), \ 18454 (vector unsigned long long)(__c), (__imm))) 18455 #endif /* __SIZEOF_INT128__ */ 18456 #endif /* __VSX__ */ 18457 18458 /* vec_genpcvm */ 18459 18460 #ifdef __VSX__ 18461 #define vec_genpcvm(__a, __imm) \ 18462 _Generic( \ 18463 (__a), vector unsigned char \ 18464 : __builtin_vsx_xxgenpcvbm((vector unsigned char)(__a), (int)(__imm)), \ 18465 vector unsigned short \ 18466 : __builtin_vsx_xxgenpcvhm((vector unsigned short)(__a), (int)(__imm)), \ 18467 vector unsigned int \ 18468 : __builtin_vsx_xxgenpcvwm((vector unsigned int)(__a), (int)(__imm)), \ 18469 vector unsigned long long \ 18470 : __builtin_vsx_xxgenpcvdm((vector unsigned long long)(__a), \ 18471 (int)(__imm))) 18472 #endif /* __VSX__ */ 18473 18474 /* vec_clr_first */ 18475 18476 static __inline__ vector signed char __ATTRS_o_ai 18477 vec_clr_first(vector signed char __a, unsigned int __n) { 18478 #ifdef __LITTLE_ENDIAN__ 18479 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a, 18480 __n); 18481 #else 18482 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a, 18483 __n); 18484 #endif 18485 } 18486 18487 static __inline__ vector unsigned char __ATTRS_o_ai 18488 vec_clr_first(vector unsigned char __a, unsigned int __n) { 18489 #ifdef __LITTLE_ENDIAN__ 18490 return (vector unsigned char)__builtin_altivec_vclrrb( 18491 (vector unsigned char)__a, __n); 18492 #else 18493 return (vector unsigned char)__builtin_altivec_vclrlb( 18494 (vector unsigned char)__a, __n); 18495 #endif 18496 } 18497 18498 /* vec_clr_last */ 18499 18500 static __inline__ vector signed char __ATTRS_o_ai 18501 vec_clr_last(vector signed char __a, unsigned int __n) { 18502 #ifdef __LITTLE_ENDIAN__ 18503 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a, 18504 __n); 18505 #else 18506 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a, 18507 __n); 18508 #endif 18509 } 18510 18511 static __inline__ vector unsigned char __ATTRS_o_ai 18512 vec_clr_last(vector unsigned char __a, unsigned int __n) { 18513 #ifdef __LITTLE_ENDIAN__ 18514 return (vector unsigned char)__builtin_altivec_vclrlb( 18515 (vector unsigned char)__a, __n); 18516 #else 18517 return (vector unsigned char)__builtin_altivec_vclrrb( 18518 (vector unsigned char)__a, __n); 18519 #endif 18520 } 18521 18522 /* vec_cntlzm */ 18523 18524 static __inline__ vector unsigned long long __ATTRS_o_ai 18525 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 18526 return __builtin_altivec_vclzdm(__a, __b); 18527 } 18528 18529 /* vec_cnttzm */ 18530 18531 static __inline__ vector unsigned long long __ATTRS_o_ai 18532 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 18533 return __builtin_altivec_vctzdm(__a, __b); 18534 } 18535 18536 /* vec_mod */ 18537 18538 static __inline__ vector signed int __ATTRS_o_ai 18539 vec_mod(vector signed int __a, vector signed int __b) { 18540 return __a % __b; 18541 } 18542 18543 static __inline__ vector unsigned int __ATTRS_o_ai 18544 vec_mod(vector unsigned int __a, vector unsigned int __b) { 18545 return __a % __b; 18546 } 18547 18548 static __inline__ vector signed long long __ATTRS_o_ai 18549 vec_mod(vector signed long long __a, vector signed long long __b) { 18550 return __a % __b; 18551 } 18552 18553 static __inline__ vector unsigned long long __ATTRS_o_ai 18554 vec_mod(vector unsigned long long __a, vector unsigned long long __b) { 18555 return __a % __b; 18556 } 18557 18558 #ifdef __SIZEOF_INT128__ 18559 static __inline__ vector signed __int128 __ATTRS_o_ai 18560 vec_mod(vector signed __int128 __a, vector signed __int128 __b) { 18561 return __a % __b; 18562 } 18563 18564 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18565 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18566 return __a % __b; 18567 } 18568 #endif 18569 18570 /* vec_sldb */ 18571 #define vec_sldb(__a, __b, __c) \ 18572 _Generic( \ 18573 (__a), vector unsigned char \ 18574 : (vector unsigned char)__builtin_altivec_vsldbi( \ 18575 (vector unsigned char)__a, (vector unsigned char)__b, \ 18576 (__c & 0x7)), \ 18577 vector signed char \ 18578 : (vector signed char)__builtin_altivec_vsldbi( \ 18579 (vector unsigned char)__a, (vector unsigned char)__b, \ 18580 (__c & 0x7)), \ 18581 vector unsigned short \ 18582 : (vector unsigned short)__builtin_altivec_vsldbi( \ 18583 (vector unsigned char)__a, (vector unsigned char)__b, \ 18584 (__c & 0x7)), \ 18585 vector signed short \ 18586 : (vector signed short)__builtin_altivec_vsldbi( \ 18587 (vector unsigned char)__a, (vector unsigned char)__b, \ 18588 (__c & 0x7)), \ 18589 vector unsigned int \ 18590 : (vector unsigned int)__builtin_altivec_vsldbi( \ 18591 (vector unsigned char)__a, (vector unsigned char)__b, \ 18592 (__c & 0x7)), \ 18593 vector signed int \ 18594 : (vector signed int)__builtin_altivec_vsldbi((vector unsigned char)__a, \ 18595 (vector unsigned char)__b, \ 18596 (__c & 0x7)), \ 18597 vector unsigned long long \ 18598 : (vector unsigned long long)__builtin_altivec_vsldbi( \ 18599 (vector unsigned char)__a, (vector unsigned char)__b, \ 18600 (__c & 0x7)), \ 18601 vector signed long long \ 18602 : (vector signed long long)__builtin_altivec_vsldbi( \ 18603 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7))) 18604 18605 /* vec_srdb */ 18606 #define vec_srdb(__a, __b, __c) \ 18607 _Generic( \ 18608 (__a), vector unsigned char \ 18609 : (vector unsigned char)__builtin_altivec_vsrdbi( \ 18610 (vector unsigned char)__a, (vector unsigned char)__b, \ 18611 (__c & 0x7)), \ 18612 vector signed char \ 18613 : (vector signed char)__builtin_altivec_vsrdbi( \ 18614 (vector unsigned char)__a, (vector unsigned char)__b, \ 18615 (__c & 0x7)), \ 18616 vector unsigned short \ 18617 : (vector unsigned short)__builtin_altivec_vsrdbi( \ 18618 (vector unsigned char)__a, (vector unsigned char)__b, \ 18619 (__c & 0x7)), \ 18620 vector signed short \ 18621 : (vector signed short)__builtin_altivec_vsrdbi( \ 18622 (vector unsigned char)__a, (vector unsigned char)__b, \ 18623 (__c & 0x7)), \ 18624 vector unsigned int \ 18625 : (vector unsigned int)__builtin_altivec_vsrdbi( \ 18626 (vector unsigned char)__a, (vector unsigned char)__b, \ 18627 (__c & 0x7)), \ 18628 vector signed int \ 18629 : (vector signed int)__builtin_altivec_vsrdbi((vector unsigned char)__a, \ 18630 (vector unsigned char)__b, \ 18631 (__c & 0x7)), \ 18632 vector unsigned long long \ 18633 : (vector unsigned long long)__builtin_altivec_vsrdbi( \ 18634 (vector unsigned char)__a, (vector unsigned char)__b, \ 18635 (__c & 0x7)), \ 18636 vector signed long long \ 18637 : (vector signed long long)__builtin_altivec_vsrdbi( \ 18638 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7))) 18639 18640 /* vec_insertl */ 18641 18642 static __inline__ vector unsigned char __ATTRS_o_ai 18643 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18644 #ifdef __LITTLE_ENDIAN__ 18645 return __builtin_altivec_vinsbrx(__b, __c, __a); 18646 #else 18647 return __builtin_altivec_vinsblx(__b, __c, __a); 18648 #endif 18649 } 18650 18651 static __inline__ vector unsigned short __ATTRS_o_ai 18652 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18653 #ifdef __LITTLE_ENDIAN__ 18654 return __builtin_altivec_vinshrx(__b, __c, __a); 18655 #else 18656 return __builtin_altivec_vinshlx(__b, __c, __a); 18657 #endif 18658 } 18659 18660 static __inline__ vector unsigned int __ATTRS_o_ai 18661 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18662 #ifdef __LITTLE_ENDIAN__ 18663 return __builtin_altivec_vinswrx(__b, __c, __a); 18664 #else 18665 return __builtin_altivec_vinswlx(__b, __c, __a); 18666 #endif 18667 } 18668 18669 static __inline__ vector unsigned long long __ATTRS_o_ai 18670 vec_insertl(unsigned long long __a, vector unsigned long long __b, 18671 unsigned int __c) { 18672 #ifdef __LITTLE_ENDIAN__ 18673 return __builtin_altivec_vinsdrx(__b, __c, __a); 18674 #else 18675 return __builtin_altivec_vinsdlx(__b, __c, __a); 18676 #endif 18677 } 18678 18679 static __inline__ vector unsigned char __ATTRS_o_ai 18680 vec_insertl(vector unsigned char __a, vector unsigned char __b, 18681 unsigned int __c) { 18682 #ifdef __LITTLE_ENDIAN__ 18683 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18684 #else 18685 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18686 #endif 18687 } 18688 18689 static __inline__ vector unsigned short __ATTRS_o_ai 18690 vec_insertl(vector unsigned short __a, vector unsigned short __b, 18691 unsigned int __c) { 18692 #ifdef __LITTLE_ENDIAN__ 18693 return __builtin_altivec_vinshvrx(__b, __c, __a); 18694 #else 18695 return __builtin_altivec_vinshvlx(__b, __c, __a); 18696 #endif 18697 } 18698 18699 static __inline__ vector unsigned int __ATTRS_o_ai 18700 vec_insertl(vector unsigned int __a, vector unsigned int __b, 18701 unsigned int __c) { 18702 #ifdef __LITTLE_ENDIAN__ 18703 return __builtin_altivec_vinswvrx(__b, __c, __a); 18704 #else 18705 return __builtin_altivec_vinswvlx(__b, __c, __a); 18706 #endif 18707 } 18708 18709 /* vec_inserth */ 18710 18711 static __inline__ vector unsigned char __ATTRS_o_ai 18712 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18713 #ifdef __LITTLE_ENDIAN__ 18714 return __builtin_altivec_vinsblx(__b, __c, __a); 18715 #else 18716 return __builtin_altivec_vinsbrx(__b, __c, __a); 18717 #endif 18718 } 18719 18720 static __inline__ vector unsigned short __ATTRS_o_ai 18721 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18722 #ifdef __LITTLE_ENDIAN__ 18723 return __builtin_altivec_vinshlx(__b, __c, __a); 18724 #else 18725 return __builtin_altivec_vinshrx(__b, __c, __a); 18726 #endif 18727 } 18728 18729 static __inline__ vector unsigned int __ATTRS_o_ai 18730 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18731 #ifdef __LITTLE_ENDIAN__ 18732 return __builtin_altivec_vinswlx(__b, __c, __a); 18733 #else 18734 return __builtin_altivec_vinswrx(__b, __c, __a); 18735 #endif 18736 } 18737 18738 static __inline__ vector unsigned long long __ATTRS_o_ai 18739 vec_inserth(unsigned long long __a, vector unsigned long long __b, 18740 unsigned int __c) { 18741 #ifdef __LITTLE_ENDIAN__ 18742 return __builtin_altivec_vinsdlx(__b, __c, __a); 18743 #else 18744 return __builtin_altivec_vinsdrx(__b, __c, __a); 18745 #endif 18746 } 18747 18748 static __inline__ vector unsigned char __ATTRS_o_ai 18749 vec_inserth(vector unsigned char __a, vector unsigned char __b, 18750 unsigned int __c) { 18751 #ifdef __LITTLE_ENDIAN__ 18752 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18753 #else 18754 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18755 #endif 18756 } 18757 18758 static __inline__ vector unsigned short __ATTRS_o_ai 18759 vec_inserth(vector unsigned short __a, vector unsigned short __b, 18760 unsigned int __c) { 18761 #ifdef __LITTLE_ENDIAN__ 18762 return __builtin_altivec_vinshvlx(__b, __c, __a); 18763 #else 18764 return __builtin_altivec_vinshvrx(__b, __c, __a); 18765 #endif 18766 } 18767 18768 static __inline__ vector unsigned int __ATTRS_o_ai 18769 vec_inserth(vector unsigned int __a, vector unsigned int __b, 18770 unsigned int __c) { 18771 #ifdef __LITTLE_ENDIAN__ 18772 return __builtin_altivec_vinswvlx(__b, __c, __a); 18773 #else 18774 return __builtin_altivec_vinswvrx(__b, __c, __a); 18775 #endif 18776 } 18777 18778 /* vec_extractl */ 18779 18780 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18781 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18782 #ifdef __LITTLE_ENDIAN__ 18783 return __builtin_altivec_vextdubvrx(__a, __b, __c); 18784 #else 18785 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); 18786 return vec_sld(__ret, __ret, 8); 18787 #endif 18788 } 18789 18790 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18791 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18792 #ifdef __LITTLE_ENDIAN__ 18793 return __builtin_altivec_vextduhvrx(__a, __b, __c); 18794 #else 18795 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); 18796 return vec_sld(__ret, __ret, 8); 18797 #endif 18798 } 18799 18800 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18801 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18802 #ifdef __LITTLE_ENDIAN__ 18803 return __builtin_altivec_vextduwvrx(__a, __b, __c); 18804 #else 18805 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); 18806 return vec_sld(__ret, __ret, 8); 18807 #endif 18808 } 18809 18810 static __inline__ vector unsigned long long __ATTRS_o_ai 18811 vec_extractl(vector unsigned long long __a, vector unsigned long long __b, 18812 unsigned int __c) { 18813 #ifdef __LITTLE_ENDIAN__ 18814 return __builtin_altivec_vextddvrx(__a, __b, __c); 18815 #else 18816 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); 18817 return vec_sld(__ret, __ret, 8); 18818 #endif 18819 } 18820 18821 /* vec_extracth */ 18822 18823 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18824 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18825 #ifdef __LITTLE_ENDIAN__ 18826 return __builtin_altivec_vextdubvlx(__a, __b, __c); 18827 #else 18828 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); 18829 return vec_sld(__ret, __ret, 8); 18830 #endif 18831 } 18832 18833 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18834 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18835 #ifdef __LITTLE_ENDIAN__ 18836 return __builtin_altivec_vextduhvlx(__a, __b, __c); 18837 #else 18838 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); 18839 return vec_sld(__ret, __ret, 8); 18840 #endif 18841 } 18842 18843 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18844 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18845 #ifdef __LITTLE_ENDIAN__ 18846 return __builtin_altivec_vextduwvlx(__a, __b, __c); 18847 #else 18848 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); 18849 return vec_sld(__ret, __ret, 8); 18850 #endif 18851 } 18852 18853 static __inline__ vector unsigned long long __ATTRS_o_ai 18854 vec_extracth(vector unsigned long long __a, vector unsigned long long __b, 18855 unsigned int __c) { 18856 #ifdef __LITTLE_ENDIAN__ 18857 return __builtin_altivec_vextddvlx(__a, __b, __c); 18858 #else 18859 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); 18860 return vec_sld(__ret, __ret, 8); 18861 #endif 18862 } 18863 18864 #ifdef __VSX__ 18865 18866 /* vec_permx */ 18867 #define vec_permx(__a, __b, __c, __d) \ 18868 _Generic( \ 18869 (__a), vector unsigned char \ 18870 : (vector unsigned char)__builtin_vsx_xxpermx( \ 18871 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18872 vector signed char \ 18873 : (vector signed char)__builtin_vsx_xxpermx( \ 18874 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18875 vector unsigned short \ 18876 : (vector unsigned short)__builtin_vsx_xxpermx( \ 18877 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18878 vector signed short \ 18879 : (vector signed short)__builtin_vsx_xxpermx( \ 18880 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18881 vector unsigned int \ 18882 : (vector unsigned int)__builtin_vsx_xxpermx( \ 18883 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18884 vector signed int \ 18885 : (vector signed int)__builtin_vsx_xxpermx( \ 18886 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18887 vector unsigned long long \ 18888 : (vector unsigned long long)__builtin_vsx_xxpermx( \ 18889 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18890 vector signed long long \ 18891 : (vector signed long long)__builtin_vsx_xxpermx( \ 18892 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18893 vector float \ 18894 : (vector float)__builtin_vsx_xxpermx( \ 18895 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \ 18896 vector double \ 18897 : (vector double)__builtin_vsx_xxpermx( \ 18898 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d)) 18899 18900 /* vec_blendv */ 18901 18902 static __inline__ vector signed char __ATTRS_o_ai 18903 vec_blendv(vector signed char __a, vector signed char __b, 18904 vector unsigned char __c) { 18905 return (vector signed char)__builtin_vsx_xxblendvb( 18906 (vector unsigned char)__a, (vector unsigned char)__b, __c); 18907 } 18908 18909 static __inline__ vector unsigned char __ATTRS_o_ai 18910 vec_blendv(vector unsigned char __a, vector unsigned char __b, 18911 vector unsigned char __c) { 18912 return __builtin_vsx_xxblendvb(__a, __b, __c); 18913 } 18914 18915 static __inline__ vector signed short __ATTRS_o_ai 18916 vec_blendv(vector signed short __a, vector signed short __b, 18917 vector unsigned short __c) { 18918 return (vector signed short)__builtin_vsx_xxblendvh( 18919 (vector unsigned short)__a, (vector unsigned short)__b, __c); 18920 } 18921 18922 static __inline__ vector unsigned short __ATTRS_o_ai 18923 vec_blendv(vector unsigned short __a, vector unsigned short __b, 18924 vector unsigned short __c) { 18925 return __builtin_vsx_xxblendvh(__a, __b, __c); 18926 } 18927 18928 static __inline__ vector signed int __ATTRS_o_ai 18929 vec_blendv(vector signed int __a, vector signed int __b, 18930 vector unsigned int __c) { 18931 return (vector signed int)__builtin_vsx_xxblendvw( 18932 (vector unsigned int)__a, (vector unsigned int)__b, __c); 18933 } 18934 18935 static __inline__ vector unsigned int __ATTRS_o_ai 18936 vec_blendv(vector unsigned int __a, vector unsigned int __b, 18937 vector unsigned int __c) { 18938 return __builtin_vsx_xxblendvw(__a, __b, __c); 18939 } 18940 18941 static __inline__ vector signed long long __ATTRS_o_ai 18942 vec_blendv(vector signed long long __a, vector signed long long __b, 18943 vector unsigned long long __c) { 18944 return (vector signed long long)__builtin_vsx_xxblendvd( 18945 (vector unsigned long long)__a, (vector unsigned long long)__b, __c); 18946 } 18947 18948 static __inline__ vector unsigned long long __ATTRS_o_ai 18949 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 18950 vector unsigned long long __c) { 18951 return (vector unsigned long long)__builtin_vsx_xxblendvd(__a, __b, __c); 18952 } 18953 18954 static __inline__ vector float __ATTRS_o_ai 18955 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 18956 return (vector float)__builtin_vsx_xxblendvw((vector unsigned int)__a, 18957 (vector unsigned int)__b, __c); 18958 } 18959 18960 static __inline__ vector double __ATTRS_o_ai 18961 vec_blendv(vector double __a, vector double __b, 18962 vector unsigned long long __c) { 18963 return (vector double)__builtin_vsx_xxblendvd( 18964 (vector unsigned long long)__a, (vector unsigned long long)__b, __c); 18965 } 18966 18967 #define vec_replace_unaligned(__a, __b, __c) \ 18968 _Generic((__a), vector signed int \ 18969 : __builtin_altivec_vinsw((vector unsigned char)__a, \ 18970 (unsigned int)__b, __c), \ 18971 vector unsigned int \ 18972 : __builtin_altivec_vinsw((vector unsigned char)__a, \ 18973 (unsigned int)__b, __c), \ 18974 vector unsigned long long \ 18975 : __builtin_altivec_vinsd((vector unsigned char)__a, \ 18976 (unsigned long long)__b, __c), \ 18977 vector signed long long \ 18978 : __builtin_altivec_vinsd((vector unsigned char)__a, \ 18979 (unsigned long long)__b, __c), \ 18980 vector float \ 18981 : __builtin_altivec_vinsw((vector unsigned char)__a, \ 18982 (unsigned int)__b, __c), \ 18983 vector double \ 18984 : __builtin_altivec_vinsd((vector unsigned char)__a, \ 18985 (unsigned long long)__b, __c)) 18986 18987 #define vec_replace_elt(__a, __b, __c) \ 18988 _Generic((__a), vector signed int \ 18989 : (vector signed int)__builtin_altivec_vinsw_elt( \ 18990 (vector unsigned char)__a, (unsigned int)__b, __c), \ 18991 vector unsigned int \ 18992 : (vector unsigned int)__builtin_altivec_vinsw_elt( \ 18993 (vector unsigned char)__a, (unsigned int)__b, __c), \ 18994 vector unsigned long long \ 18995 : (vector unsigned long long)__builtin_altivec_vinsd_elt( \ 18996 (vector unsigned char)__a, (unsigned long long)__b, __c), \ 18997 vector signed long long \ 18998 : (vector signed long long)__builtin_altivec_vinsd_elt( \ 18999 (vector unsigned char)__a, (unsigned long long)__b, __c), \ 19000 vector float \ 19001 : (vector float)__builtin_altivec_vinsw_elt( \ 19002 (vector unsigned char)__a, (unsigned int)__b, __c), \ 19003 vector double \ 19004 : (vector double)__builtin_altivec_vinsd_elt( \ 19005 (vector unsigned char)__a, (unsigned long long)__b, __c)) 19006 19007 /* vec_splati */ 19008 19009 #define vec_splati(__a) \ 19010 _Generic((__a), signed int \ 19011 : ((vector signed int)__a), unsigned int \ 19012 : ((vector unsigned int)__a), float \ 19013 : ((vector float)__a)) 19014 19015 /* vec_spatid */ 19016 19017 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 19018 return ((vector double)((double)__a)); 19019 } 19020 19021 /* vec_splati_ins */ 19022 19023 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 19024 vector signed int __a, const unsigned int __b, const signed int __c) { 19025 const unsigned int __d = __b & 0x01; 19026 #ifdef __LITTLE_ENDIAN__ 19027 __a[1 - __d] = __c; 19028 __a[3 - __d] = __c; 19029 #else 19030 __a[__d] = __c; 19031 __a[2 + __d] = __c; 19032 #endif 19033 return __a; 19034 } 19035 19036 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 19037 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 19038 const unsigned int __d = __b & 0x01; 19039 #ifdef __LITTLE_ENDIAN__ 19040 __a[1 - __d] = __c; 19041 __a[3 - __d] = __c; 19042 #else 19043 __a[__d] = __c; 19044 __a[2 + __d] = __c; 19045 #endif 19046 return __a; 19047 } 19048 19049 static __inline__ vector float __ATTRS_o_ai 19050 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 19051 const unsigned int __d = __b & 0x01; 19052 #ifdef __LITTLE_ENDIAN__ 19053 __a[1 - __d] = __c; 19054 __a[3 - __d] = __c; 19055 #else 19056 __a[__d] = __c; 19057 __a[2 + __d] = __c; 19058 #endif 19059 return __a; 19060 } 19061 19062 /* vec_test_lsbb_all_ones */ 19063 19064 static __inline__ int __ATTRS_o_ai 19065 vec_test_lsbb_all_ones(vector unsigned char __a) { 19066 return __builtin_vsx_xvtlsbb(__a, 1); 19067 } 19068 19069 /* vec_test_lsbb_all_zeros */ 19070 19071 static __inline__ int __ATTRS_o_ai 19072 vec_test_lsbb_all_zeros(vector unsigned char __a) { 19073 return __builtin_vsx_xvtlsbb(__a, 0); 19074 } 19075 #endif /* __VSX__ */ 19076 19077 /* vec_stril */ 19078 19079 static __inline__ vector unsigned char __ATTRS_o_ai 19080 vec_stril(vector unsigned char __a) { 19081 #ifdef __LITTLE_ENDIAN__ 19082 return (vector unsigned char)__builtin_altivec_vstribr( 19083 (vector unsigned char)__a); 19084 #else 19085 return (vector unsigned char)__builtin_altivec_vstribl( 19086 (vector unsigned char)__a); 19087 #endif 19088 } 19089 19090 static __inline__ vector signed char __ATTRS_o_ai 19091 vec_stril(vector signed char __a) { 19092 #ifdef __LITTLE_ENDIAN__ 19093 return (vector signed char)__builtin_altivec_vstribr( 19094 (vector unsigned char)__a); 19095 #else 19096 return (vector signed char)__builtin_altivec_vstribl( 19097 (vector unsigned char)__a); 19098 #endif 19099 } 19100 19101 static __inline__ vector unsigned short __ATTRS_o_ai 19102 vec_stril(vector unsigned short __a) { 19103 #ifdef __LITTLE_ENDIAN__ 19104 return (vector unsigned short)__builtin_altivec_vstrihr( 19105 (vector signed short)__a); 19106 #else 19107 return (vector unsigned short)__builtin_altivec_vstrihl( 19108 (vector signed short)__a); 19109 #endif 19110 } 19111 19112 static __inline__ vector signed short __ATTRS_o_ai 19113 vec_stril(vector signed short __a) { 19114 #ifdef __LITTLE_ENDIAN__ 19115 return __builtin_altivec_vstrihr(__a); 19116 #else 19117 return __builtin_altivec_vstrihl(__a); 19118 #endif 19119 } 19120 19121 /* vec_stril_p */ 19122 19123 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { 19124 #ifdef __LITTLE_ENDIAN__ 19125 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a); 19126 #else 19127 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a); 19128 #endif 19129 } 19130 19131 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { 19132 #ifdef __LITTLE_ENDIAN__ 19133 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a); 19134 #else 19135 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a); 19136 #endif 19137 } 19138 19139 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { 19140 #ifdef __LITTLE_ENDIAN__ 19141 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 19142 #else 19143 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 19144 #endif 19145 } 19146 19147 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { 19148 #ifdef __LITTLE_ENDIAN__ 19149 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 19150 #else 19151 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 19152 #endif 19153 } 19154 19155 /* vec_strir */ 19156 19157 static __inline__ vector unsigned char __ATTRS_o_ai 19158 vec_strir(vector unsigned char __a) { 19159 #ifdef __LITTLE_ENDIAN__ 19160 return (vector unsigned char)__builtin_altivec_vstribl( 19161 (vector unsigned char)__a); 19162 #else 19163 return (vector unsigned char)__builtin_altivec_vstribr( 19164 (vector unsigned char)__a); 19165 #endif 19166 } 19167 19168 static __inline__ vector signed char __ATTRS_o_ai 19169 vec_strir(vector signed char __a) { 19170 #ifdef __LITTLE_ENDIAN__ 19171 return (vector signed char)__builtin_altivec_vstribl( 19172 (vector unsigned char)__a); 19173 #else 19174 return (vector signed char)__builtin_altivec_vstribr( 19175 (vector unsigned char)__a); 19176 #endif 19177 } 19178 19179 static __inline__ vector unsigned short __ATTRS_o_ai 19180 vec_strir(vector unsigned short __a) { 19181 #ifdef __LITTLE_ENDIAN__ 19182 return (vector unsigned short)__builtin_altivec_vstrihl( 19183 (vector signed short)__a); 19184 #else 19185 return (vector unsigned short)__builtin_altivec_vstrihr( 19186 (vector signed short)__a); 19187 #endif 19188 } 19189 19190 static __inline__ vector signed short __ATTRS_o_ai 19191 vec_strir(vector signed short __a) { 19192 #ifdef __LITTLE_ENDIAN__ 19193 return __builtin_altivec_vstrihl(__a); 19194 #else 19195 return __builtin_altivec_vstrihr(__a); 19196 #endif 19197 } 19198 19199 /* vec_strir_p */ 19200 19201 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { 19202 #ifdef __LITTLE_ENDIAN__ 19203 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a); 19204 #else 19205 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a); 19206 #endif 19207 } 19208 19209 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { 19210 #ifdef __LITTLE_ENDIAN__ 19211 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a); 19212 #else 19213 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a); 19214 #endif 19215 } 19216 19217 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { 19218 #ifdef __LITTLE_ENDIAN__ 19219 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 19220 #else 19221 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 19222 #endif 19223 } 19224 19225 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { 19226 #ifdef __LITTLE_ENDIAN__ 19227 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 19228 #else 19229 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 19230 #endif 19231 } 19232 19233 /* vs[l | r | ra] */ 19234 19235 #ifdef __SIZEOF_INT128__ 19236 static __inline__ vector unsigned __int128 __ATTRS_o_ai 19237 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 19238 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19239 __CHAR_BIT__)); 19240 } 19241 19242 static __inline__ vector signed __int128 __ATTRS_o_ai 19243 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { 19244 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19245 __CHAR_BIT__)); 19246 } 19247 19248 static __inline__ vector unsigned __int128 __ATTRS_o_ai 19249 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { 19250 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19251 __CHAR_BIT__)); 19252 } 19253 19254 static __inline__ vector signed __int128 __ATTRS_o_ai 19255 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { 19256 return ( 19257 vector signed __int128)(((vector unsigned __int128)__a) >> 19258 (__b % 19259 (vector unsigned __int128)(sizeof( 19260 unsigned __int128) * 19261 __CHAR_BIT__))); 19262 } 19263 19264 static __inline__ vector unsigned __int128 __ATTRS_o_ai 19265 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { 19266 return ( 19267 vector unsigned __int128)(((vector signed __int128)__a) >> 19268 (__b % 19269 (vector unsigned __int128)(sizeof( 19270 unsigned __int128) * 19271 __CHAR_BIT__))); 19272 } 19273 19274 static __inline__ vector signed __int128 __ATTRS_o_ai 19275 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { 19276 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19277 __CHAR_BIT__)); 19278 } 19279 19280 #endif /* __SIZEOF_INT128__ */ 19281 #endif /* __POWER10_VECTOR__ */ 19282 19283 #ifdef __POWER8_VECTOR__ 19284 #define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps)) 19285 #define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps)) 19286 19287 static __inline__ long __bcdadd_ofl(vector unsigned char __a, 19288 vector unsigned char __b) { 19289 return __builtin_ppc_bcdadd_p(__CR6_SO, __a, __b); 19290 } 19291 19292 static __inline__ long __bcdsub_ofl(vector unsigned char __a, 19293 vector unsigned char __b) { 19294 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __b); 19295 } 19296 19297 static __inline__ long __bcd_invalid(vector unsigned char __a) { 19298 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __a); 19299 } 19300 19301 static __inline__ long __bcdcmpeq(vector unsigned char __a, 19302 vector unsigned char __b) { 19303 return __builtin_ppc_bcdsub_p(__CR6_EQ, __a, __b); 19304 } 19305 19306 static __inline__ long __bcdcmplt(vector unsigned char __a, 19307 vector unsigned char __b) { 19308 return __builtin_ppc_bcdsub_p(__CR6_LT, __a, __b); 19309 } 19310 19311 static __inline__ long __bcdcmpgt(vector unsigned char __a, 19312 vector unsigned char __b) { 19313 return __builtin_ppc_bcdsub_p(__CR6_GT, __a, __b); 19314 } 19315 19316 static __inline__ long __bcdcmple(vector unsigned char __a, 19317 vector unsigned char __b) { 19318 return __builtin_ppc_bcdsub_p(__CR6_GT_REV, __a, __b); 19319 } 19320 19321 static __inline__ long __bcdcmpge(vector unsigned char __a, 19322 vector unsigned char __b) { 19323 return __builtin_ppc_bcdsub_p(__CR6_LT_REV, __a, __b); 19324 } 19325 19326 #endif // __POWER8_VECTOR__ 19327 19328 #undef __ATTRS_o_ai 19329 19330 #endif /* __ALTIVEC_H */ 19331