2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. _powerpc-altivec-vsx-built-in-functions:
8 PowerPC AltiVec/VSX Built-in Functions
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 GCC provides an interface for the PowerPC family of processors to access
12 the AltiVec operations described in Motorola's AltiVec Programming
13 Interface Manual. The interface is made available by including
14 ``<altivec.h>`` and using :option:`-maltivec` and
15 :option:`-mabi=altivec`. The interface supports the following vector
34 GCC's implementation of the high-level language interface available from
35 C and C++ code differs from Motorola's documentation in several ways.
37 * A vector constant is a list of constant expressions within curly braces.
39 * A vector initializer requires no cast if the vector constant is of the
40 same type as the variable it is initializing.
42 * If ``signed`` or ``unsigned`` is omitted, the signedness of the
43 vector type is the default signedness of the base type. The default
44 varies depending on the operating system, so a portable program should
45 always specify the signedness.
47 * Compiling with :option:`-maltivec` adds keywords ``__vector``,
48 ``vector``, ``__pixel``, ``pixel``, ``__bool`` and
49 ``bool``. When compiling ISO C, the context-sensitive substitution
50 of the keywords ``vector``, ``pixel`` and ``bool`` is
51 disabled. To use them, you must include ``<altivec.h>`` instead.
53 * GCC allows using a ``typedef`` name as the type specifier for a
54 vector type, but only under the following circumstances:
56 * When using ``__vector`` instead of ``vector`` ; for example,
60 typedef signed short int16;
63 * When using ``vector`` in keyword-and-predefine mode; for example,
67 typedef signed short int16;
70 Note that keyword-and-predefine mode is enabled by disabling GNU
71 extensions (e.g., by using ``-std=c11``) and including
74 * For C, overloaded functions are implemented with macros so the following
79 vec_add ((vector signed int){1, 2, 3, 4}, foo);
81 Since ``vec_add`` is a macro, the vector constant in the example
82 is treated as four separate arguments. Wrap the entire argument in
83 parentheses for this to work.
87 Only the ``<altivec.h>`` interface is supported.
88 Internally, GCC uses built-in functions to achieve the functionality in
89 the aforementioned header file, but they are not supported and are
90 subject to change without notice.
92 GCC complies with the Power Vector Intrinsic Programming Reference (PVIPR),
94 https://openpowerfoundation.org/?resource_lib=power-vector-intrinsic-programming-reference.
95 Chapter 4 of this document fully documents the vector API interfaces
97 provided by compliant compilers. Programmers should preferentially use
98 the interfaces described therein. However, historically GCC has provided
99 additional interfaces for access to vector instructions. These are
100 briefly described below. Where the PVIPR provides a portable interface,
101 other functions in GCC that provide the same capabilities should be
102 considered deprecated.
104 The PVIPR documents the following overloaded functions:
128 - ``vec_all_numeric``
142 - ``vec_any_numeric``
147 * - ``vec_cipher_be``
148 - ``vec_cipherlast_be``
174 * - ``vec_extract_exp``
175 - ``vec_extract_fp32_from_shorth``
176 - ``vec_extract_fp32_from_shortl``
177 * - ``vec_extract_sig``
179 - ``vec_first_match_index``
180 * - ``vec_first_match_or_eos_index``
181 - ``vec_first_mismatch_index``
182 - ``vec_first_mismatch_or_eos_index``
216 * - ``vec_ncipherlast_be``
225 * - ``vec_pack_to_short_fp32``
229 - ``vec_parity_lsbb``
247 - ``vec_shasigma_be``
261 * - ``vec_splat_s32``
264 * - ``vec_splat_u32``
283 - ``vec_test_data_class``
288 * - ``vec_unsigned2``
305 .. _powerpc-altivec-built-in-functions-on-isa-2.05:
307 PowerPC AltiVec Built-in Functions on ISA 2.05
308 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 The following interfaces are supported for the generic and specific
311 AltiVec operations and the AltiVec predicates. In cases where there
312 is a direct mapping between generic and specific operations, only the
313 generic names are shown here, although the specific operations can also
316 Arguments that are documented as ``const int`` require literal
317 integral values within the range required for that operation.
319 Only functions excluded from the PVIPR are listed here.
323 void vec_dss (const int);
325 void vec_dssall (void);
327 void vec_dst (const vector unsigned char *, int, const int);
328 void vec_dst (const vector signed char *, int, const int);
329 void vec_dst (const vector bool char *, int, const int);
330 void vec_dst (const vector unsigned short *, int, const int);
331 void vec_dst (const vector signed short *, int, const int);
332 void vec_dst (const vector bool short *, int, const int);
333 void vec_dst (const vector pixel *, int, const int);
334 void vec_dst (const vector unsigned int *, int, const int);
335 void vec_dst (const vector signed int *, int, const int);
336 void vec_dst (const vector bool int *, int, const int);
337 void vec_dst (const vector float *, int, const int);
338 void vec_dst (const unsigned char *, int, const int);
339 void vec_dst (const signed char *, int, const int);
340 void vec_dst (const unsigned short *, int, const int);
341 void vec_dst (const short *, int, const int);
342 void vec_dst (const unsigned int *, int, const int);
343 void vec_dst (const int *, int, const int);
344 void vec_dst (const float *, int, const int);
346 void vec_dstst (const vector unsigned char *, int, const int);
347 void vec_dstst (const vector signed char *, int, const int);
348 void vec_dstst (const vector bool char *, int, const int);
349 void vec_dstst (const vector unsigned short *, int, const int);
350 void vec_dstst (const vector signed short *, int, const int);
351 void vec_dstst (const vector bool short *, int, const int);
352 void vec_dstst (const vector pixel *, int, const int);
353 void vec_dstst (const vector unsigned int *, int, const int);
354 void vec_dstst (const vector signed int *, int, const int);
355 void vec_dstst (const vector bool int *, int, const int);
356 void vec_dstst (const vector float *, int, const int);
357 void vec_dstst (const unsigned char *, int, const int);
358 void vec_dstst (const signed char *, int, const int);
359 void vec_dstst (const unsigned short *, int, const int);
360 void vec_dstst (const short *, int, const int);
361 void vec_dstst (const unsigned int *, int, const int);
362 void vec_dstst (const int *, int, const int);
363 void vec_dstst (const unsigned long *, int, const int);
364 void vec_dstst (const long *, int, const int);
365 void vec_dstst (const float *, int, const int);
367 void vec_dststt (const vector unsigned char *, int, const int);
368 void vec_dststt (const vector signed char *, int, const int);
369 void vec_dststt (const vector bool char *, int, const int);
370 void vec_dststt (const vector unsigned short *, int, const int);
371 void vec_dststt (const vector signed short *, int, const int);
372 void vec_dststt (const vector bool short *, int, const int);
373 void vec_dststt (const vector pixel *, int, const int);
374 void vec_dststt (const vector unsigned int *, int, const int);
375 void vec_dststt (const vector signed int *, int, const int);
376 void vec_dststt (const vector bool int *, int, const int);
377 void vec_dststt (const vector float *, int, const int);
378 void vec_dststt (const unsigned char *, int, const int);
379 void vec_dststt (const signed char *, int, const int);
380 void vec_dststt (const unsigned short *, int, const int);
381 void vec_dststt (const short *, int, const int);
382 void vec_dststt (const unsigned int *, int, const int);
383 void vec_dststt (const int *, int, const int);
384 void vec_dststt (const float *, int, const int);
386 void vec_dstt (const vector unsigned char *, int, const int);
387 void vec_dstt (const vector signed char *, int, const int);
388 void vec_dstt (const vector bool char *, int, const int);
389 void vec_dstt (const vector unsigned short *, int, const int);
390 void vec_dstt (const vector signed short *, int, const int);
391 void vec_dstt (const vector bool short *, int, const int);
392 void vec_dstt (const vector pixel *, int, const int);
393 void vec_dstt (const vector unsigned int *, int, const int);
394 void vec_dstt (const vector signed int *, int, const int);
395 void vec_dstt (const vector bool int *, int, const int);
396 void vec_dstt (const vector float *, int, const int);
397 void vec_dstt (const unsigned char *, int, const int);
398 void vec_dstt (const signed char *, int, const int);
399 void vec_dstt (const unsigned short *, int, const int);
400 void vec_dstt (const short *, int, const int);
401 void vec_dstt (const unsigned int *, int, const int);
402 void vec_dstt (const int *, int, const int);
403 void vec_dstt (const float *, int, const int);
405 vector signed char vec_lvebx (int, char *);
406 vector unsigned char vec_lvebx (int, unsigned char *);
408 vector signed short vec_lvehx (int, short *);
409 vector unsigned short vec_lvehx (int, unsigned short *);
411 vector float vec_lvewx (int, float *);
412 vector signed int vec_lvewx (int, int *);
413 vector unsigned int vec_lvewx (int, unsigned int *);
415 vector unsigned char vec_lvsl (int, const unsigned char *);
416 vector unsigned char vec_lvsl (int, const signed char *);
417 vector unsigned char vec_lvsl (int, const unsigned short *);
418 vector unsigned char vec_lvsl (int, const short *);
419 vector unsigned char vec_lvsl (int, const unsigned int *);
420 vector unsigned char vec_lvsl (int, const int *);
421 vector unsigned char vec_lvsl (int, const float *);
423 vector unsigned char vec_lvsr (int, const unsigned char *);
424 vector unsigned char vec_lvsr (int, const signed char *);
425 vector unsigned char vec_lvsr (int, const unsigned short *);
426 vector unsigned char vec_lvsr (int, const short *);
427 vector unsigned char vec_lvsr (int, const unsigned int *);
428 vector unsigned char vec_lvsr (int, const int *);
429 vector unsigned char vec_lvsr (int, const float *);
431 void vec_stvebx (vector signed char, int, signed char *);
432 void vec_stvebx (vector unsigned char, int, unsigned char *);
433 void vec_stvebx (vector bool char, int, signed char *);
434 void vec_stvebx (vector bool char, int, unsigned char *);
436 void vec_stvehx (vector signed short, int, short *);
437 void vec_stvehx (vector unsigned short, int, unsigned short *);
438 void vec_stvehx (vector bool short, int, short *);
439 void vec_stvehx (vector bool short, int, unsigned short *);
441 void vec_stvewx (vector float, int, float *);
442 void vec_stvewx (vector signed int, int, int *);
443 void vec_stvewx (vector unsigned int, int, unsigned int *);
444 void vec_stvewx (vector bool int, int, int *);
445 void vec_stvewx (vector bool int, int, unsigned int *);
447 vector float vec_vaddfp (vector float, vector float);
449 vector signed char vec_vaddsbs (vector bool char, vector signed char);
450 vector signed char vec_vaddsbs (vector signed char, vector bool char);
451 vector signed char vec_vaddsbs (vector signed char, vector signed char);
453 vector signed short vec_vaddshs (vector bool short, vector signed short);
454 vector signed short vec_vaddshs (vector signed short, vector bool short);
455 vector signed short vec_vaddshs (vector signed short, vector signed short);
457 vector signed int vec_vaddsws (vector bool int, vector signed int);
458 vector signed int vec_vaddsws (vector signed int, vector bool int);
459 vector signed int vec_vaddsws (vector signed int, vector signed int);
461 vector signed char vec_vaddubm (vector bool char, vector signed char);
462 vector signed char vec_vaddubm (vector signed char, vector bool char);
463 vector signed char vec_vaddubm (vector signed char, vector signed char);
464 vector unsigned char vec_vaddubm (vector bool char, vector unsigned char);
465 vector unsigned char vec_vaddubm (vector unsigned char, vector bool char);
466 vector unsigned char vec_vaddubm (vector unsigned char, vector unsigned char);
468 vector unsigned char vec_vaddubs (vector bool char, vector unsigned char);
469 vector unsigned char vec_vaddubs (vector unsigned char, vector bool char);
470 vector unsigned char vec_vaddubs (vector unsigned char, vector unsigned char);
472 vector signed short vec_vadduhm (vector bool short, vector signed short);
473 vector signed short vec_vadduhm (vector signed short, vector bool short);
474 vector signed short vec_vadduhm (vector signed short, vector signed short);
475 vector unsigned short vec_vadduhm (vector bool short, vector unsigned short);
476 vector unsigned short vec_vadduhm (vector unsigned short, vector bool short);
477 vector unsigned short vec_vadduhm (vector unsigned short, vector unsigned short);
479 vector unsigned short vec_vadduhs (vector bool short, vector unsigned short);
480 vector unsigned short vec_vadduhs (vector unsigned short, vector bool short);
481 vector unsigned short vec_vadduhs (vector unsigned short, vector unsigned short);
483 vector signed int vec_vadduwm (vector bool int, vector signed int);
484 vector signed int vec_vadduwm (vector signed int, vector bool int);
485 vector signed int vec_vadduwm (vector signed int, vector signed int);
486 vector unsigned int vec_vadduwm (vector bool int, vector unsigned int);
487 vector unsigned int vec_vadduwm (vector unsigned int, vector bool int);
488 vector unsigned int vec_vadduwm (vector unsigned int, vector unsigned int);
490 vector unsigned int vec_vadduws (vector bool int, vector unsigned int);
491 vector unsigned int vec_vadduws (vector unsigned int, vector bool int);
492 vector unsigned int vec_vadduws (vector unsigned int, vector unsigned int);
494 vector signed char vec_vavgsb (vector signed char, vector signed char);
496 vector signed short vec_vavgsh (vector signed short, vector signed short);
498 vector signed int vec_vavgsw (vector signed int, vector signed int);
500 vector unsigned char vec_vavgub (vector unsigned char, vector unsigned char);
502 vector unsigned short vec_vavguh (vector unsigned short, vector unsigned short);
504 vector unsigned int vec_vavguw (vector unsigned int, vector unsigned int);
506 vector float vec_vcfsx (vector signed int, const int);
508 vector float vec_vcfux (vector unsigned int, const int);
510 vector bool int vec_vcmpeqfp (vector float, vector float);
512 vector bool char vec_vcmpequb (vector signed char, vector signed char);
513 vector bool char vec_vcmpequb (vector unsigned char, vector unsigned char);
515 vector bool short vec_vcmpequh (vector signed short, vector signed short);
516 vector bool short vec_vcmpequh (vector unsigned short, vector unsigned short);
518 vector bool int vec_vcmpequw (vector signed int, vector signed int);
519 vector bool int vec_vcmpequw (vector unsigned int, vector unsigned int);
521 vector bool int vec_vcmpgtfp (vector float, vector float);
523 vector bool char vec_vcmpgtsb (vector signed char, vector signed char);
525 vector bool short vec_vcmpgtsh (vector signed short, vector signed short);
527 vector bool int vec_vcmpgtsw (vector signed int, vector signed int);
529 vector bool char vec_vcmpgtub (vector unsigned char, vector unsigned char);
531 vector bool short vec_vcmpgtuh (vector unsigned short, vector unsigned short);
533 vector bool int vec_vcmpgtuw (vector unsigned int, vector unsigned int);
535 vector float vec_vmaxfp (vector float, vector float);
537 vector signed char vec_vmaxsb (vector bool char, vector signed char);
538 vector signed char vec_vmaxsb (vector signed char, vector bool char);
539 vector signed char vec_vmaxsb (vector signed char, vector signed char);
541 vector signed short vec_vmaxsh (vector bool short, vector signed short);
542 vector signed short vec_vmaxsh (vector signed short, vector bool short);
543 vector signed short vec_vmaxsh (vector signed short, vector signed short);
545 vector signed int vec_vmaxsw (vector bool int, vector signed int);
546 vector signed int vec_vmaxsw (vector signed int, vector bool int);
547 vector signed int vec_vmaxsw (vector signed int, vector signed int);
549 vector unsigned char vec_vmaxub (vector bool char, vector unsigned char);
550 vector unsigned char vec_vmaxub (vector unsigned char, vector bool char);
551 vector unsigned char vec_vmaxub (vector unsigned char, vector unsigned char);
553 vector unsigned short vec_vmaxuh (vector bool short, vector unsigned short);
554 vector unsigned short vec_vmaxuh (vector unsigned short, vector bool short);
555 vector unsigned short vec_vmaxuh (vector unsigned short, vector unsigned short);
557 vector unsigned int vec_vmaxuw (vector bool int, vector unsigned int);
558 vector unsigned int vec_vmaxuw (vector unsigned int, vector bool int);
559 vector unsigned int vec_vmaxuw (vector unsigned int, vector unsigned int);
561 vector float vec_vminfp (vector float, vector float);
563 vector signed char vec_vminsb (vector bool char, vector signed char);
564 vector signed char vec_vminsb (vector signed char, vector bool char);
565 vector signed char vec_vminsb (vector signed char, vector signed char);
567 vector signed short vec_vminsh (vector bool short, vector signed short);
568 vector signed short vec_vminsh (vector signed short, vector bool short);
569 vector signed short vec_vminsh (vector signed short, vector signed short);
571 vector signed int vec_vminsw (vector bool int, vector signed int);
572 vector signed int vec_vminsw (vector signed int, vector bool int);
573 vector signed int vec_vminsw (vector signed int, vector signed int);
575 vector unsigned char vec_vminub (vector bool char, vector unsigned char);
576 vector unsigned char vec_vminub (vector unsigned char, vector bool char);
577 vector unsigned char vec_vminub (vector unsigned char, vector unsigned char);
579 vector unsigned short vec_vminuh (vector bool short, vector unsigned short);
580 vector unsigned short vec_vminuh (vector unsigned short, vector bool short);
581 vector unsigned short vec_vminuh (vector unsigned short, vector unsigned short);
583 vector unsigned int vec_vminuw (vector bool int, vector unsigned int);
584 vector unsigned int vec_vminuw (vector unsigned int, vector bool int);
585 vector unsigned int vec_vminuw (vector unsigned int, vector unsigned int);
587 vector bool char vec_vmrghb (vector bool char, vector bool char);
588 vector signed char vec_vmrghb (vector signed char, vector signed char);
589 vector unsigned char vec_vmrghb (vector unsigned char, vector unsigned char);
591 vector bool short vec_vmrghh (vector bool short, vector bool short);
592 vector signed short vec_vmrghh (vector signed short, vector signed short);
593 vector unsigned short vec_vmrghh (vector unsigned short, vector unsigned short);
594 vector pixel vec_vmrghh (vector pixel, vector pixel);
596 vector float vec_vmrghw (vector float, vector float);
597 vector bool int vec_vmrghw (vector bool int, vector bool int);
598 vector signed int vec_vmrghw (vector signed int, vector signed int);
599 vector unsigned int vec_vmrghw (vector unsigned int, vector unsigned int);
601 vector bool char vec_vmrglb (vector bool char, vector bool char);
602 vector signed char vec_vmrglb (vector signed char, vector signed char);
603 vector unsigned char vec_vmrglb (vector unsigned char, vector unsigned char);
605 vector bool short vec_vmrglh (vector bool short, vector bool short);
606 vector signed short vec_vmrglh (vector signed short, vector signed short);
607 vector unsigned short vec_vmrglh (vector unsigned short, vector unsigned short);
608 vector pixel vec_vmrglh (vector pixel, vector pixel);
610 vector float vec_vmrglw (vector float, vector float);
611 vector signed int vec_vmrglw (vector signed int, vector signed int);
612 vector unsigned int vec_vmrglw (vector unsigned int, vector unsigned int);
613 vector bool int vec_vmrglw (vector bool int, vector bool int);
615 vector signed int vec_vmsummbm (vector signed char, vector unsigned char,
618 vector signed int vec_vmsumshm (vector signed short, vector signed short,
621 vector signed int vec_vmsumshs (vector signed short, vector signed short,
624 vector unsigned int vec_vmsumubm (vector unsigned char, vector unsigned char,
625 vector unsigned int);
627 vector unsigned int vec_vmsumuhm (vector unsigned short, vector unsigned short,
628 vector unsigned int);
630 vector unsigned int vec_vmsumuhs (vector unsigned short, vector unsigned short,
631 vector unsigned int);
633 vector signed short vec_vmulesb (vector signed char, vector signed char);
635 vector signed int vec_vmulesh (vector signed short, vector signed short);
637 vector unsigned short vec_vmuleub (vector unsigned char, vector unsigned char);
639 vector unsigned int vec_vmuleuh (vector unsigned short, vector unsigned short);
641 vector signed short vec_vmulosb (vector signed char, vector signed char);
643 vector signed int vec_vmulosh (vector signed short, vector signed short);
645 vector unsigned short vec_vmuloub (vector unsigned char, vector unsigned char);
647 vector unsigned int vec_vmulouh (vector unsigned short, vector unsigned short);
649 vector signed char vec_vpkshss (vector signed short, vector signed short);
651 vector unsigned char vec_vpkshus (vector signed short, vector signed short);
653 vector signed short vec_vpkswss (vector signed int, vector signed int);
655 vector unsigned short vec_vpkswus (vector signed int, vector signed int);
657 vector bool char vec_vpkuhum (vector bool short, vector bool short);
658 vector signed char vec_vpkuhum (vector signed short, vector signed short);
659 vector unsigned char vec_vpkuhum (vector unsigned short, vector unsigned short);
661 vector unsigned char vec_vpkuhus (vector unsigned short, vector unsigned short);
663 vector bool short vec_vpkuwum (vector bool int, vector bool int);
664 vector signed short vec_vpkuwum (vector signed int, vector signed int);
665 vector unsigned short vec_vpkuwum (vector unsigned int, vector unsigned int);
667 vector unsigned short vec_vpkuwus (vector unsigned int, vector unsigned int);
669 vector signed char vec_vrlb (vector signed char, vector unsigned char);
670 vector unsigned char vec_vrlb (vector unsigned char, vector unsigned char);
672 vector signed short vec_vrlh (vector signed short, vector unsigned short);
673 vector unsigned short vec_vrlh (vector unsigned short, vector unsigned short);
675 vector signed int vec_vrlw (vector signed int, vector unsigned int);
676 vector unsigned int vec_vrlw (vector unsigned int, vector unsigned int);
678 vector signed char vec_vslb (vector signed char, vector unsigned char);
679 vector unsigned char vec_vslb (vector unsigned char, vector unsigned char);
681 vector signed short vec_vslh (vector signed short, vector unsigned short);
682 vector unsigned short vec_vslh (vector unsigned short, vector unsigned short);
684 vector signed int vec_vslw (vector signed int, vector unsigned int);
685 vector unsigned int vec_vslw (vector unsigned int, vector unsigned int);
687 vector signed char vec_vspltb (vector signed char, const int);
688 vector unsigned char vec_vspltb (vector unsigned char, const int);
689 vector bool char vec_vspltb (vector bool char, const int);
691 vector bool short vec_vsplth (vector bool short, const int);
692 vector signed short vec_vsplth (vector signed short, const int);
693 vector unsigned short vec_vsplth (vector unsigned short, const int);
694 vector pixel vec_vsplth (vector pixel, const int);
696 vector float vec_vspltw (vector float, const int);
697 vector signed int vec_vspltw (vector signed int, const int);
698 vector unsigned int vec_vspltw (vector unsigned int, const int);
699 vector bool int vec_vspltw (vector bool int, const int);
701 vector signed char vec_vsrab (vector signed char, vector unsigned char);
702 vector unsigned char vec_vsrab (vector unsigned char, vector unsigned char);
704 vector signed short vec_vsrah (vector signed short, vector unsigned short);
705 vector unsigned short vec_vsrah (vector unsigned short, vector unsigned short);
707 vector signed int vec_vsraw (vector signed int, vector unsigned int);
708 vector unsigned int vec_vsraw (vector unsigned int, vector unsigned int);
710 vector signed char vec_vsrb (vector signed char, vector unsigned char);
711 vector unsigned char vec_vsrb (vector unsigned char, vector unsigned char);
713 vector signed short vec_vsrh (vector signed short, vector unsigned short);
714 vector unsigned short vec_vsrh (vector unsigned short, vector unsigned short);
716 vector signed int vec_vsrw (vector signed int, vector unsigned int);
717 vector unsigned int vec_vsrw (vector unsigned int, vector unsigned int);
719 vector float vec_vsubfp (vector float, vector float);
721 vector signed char vec_vsubsbs (vector bool char, vector signed char);
722 vector signed char vec_vsubsbs (vector signed char, vector bool char);
723 vector signed char vec_vsubsbs (vector signed char, vector signed char);
725 vector signed short vec_vsubshs (vector bool short, vector signed short);
726 vector signed short vec_vsubshs (vector signed short, vector bool short);
727 vector signed short vec_vsubshs (vector signed short, vector signed short);
729 vector signed int vec_vsubsws (vector bool int, vector signed int);
730 vector signed int vec_vsubsws (vector signed int, vector bool int);
731 vector signed int vec_vsubsws (vector signed int, vector signed int);
733 vector signed char vec_vsububm (vector bool char, vector signed char);
734 vector signed char vec_vsububm (vector signed char, vector bool char);
735 vector signed char vec_vsububm (vector signed char, vector signed char);
736 vector unsigned char vec_vsububm (vector bool char, vector unsigned char);
737 vector unsigned char vec_vsububm (vector unsigned char, vector bool char);
738 vector unsigned char vec_vsububm (vector unsigned char, vector unsigned char);
740 vector unsigned char vec_vsububs (vector bool char, vector unsigned char);
741 vector unsigned char vec_vsububs (vector unsigned char, vector bool char);
742 vector unsigned char vec_vsububs (vector unsigned char, vector unsigned char);
744 vector signed short vec_vsubuhm (vector bool short, vector signed short);
745 vector signed short vec_vsubuhm (vector signed short, vector bool short);
746 vector signed short vec_vsubuhm (vector signed short, vector signed short);
747 vector unsigned short vec_vsubuhm (vector bool short, vector unsigned short);
748 vector unsigned short vec_vsubuhm (vector unsigned short, vector bool short);
749 vector unsigned short vec_vsubuhm (vector unsigned short, vector unsigned short);
751 vector unsigned short vec_vsubuhs (vector bool short, vector unsigned short);
752 vector unsigned short vec_vsubuhs (vector unsigned short, vector bool short);
753 vector unsigned short vec_vsubuhs (vector unsigned short, vector unsigned short);
755 vector signed int vec_vsubuwm (vector bool int, vector signed int);
756 vector signed int vec_vsubuwm (vector signed int, vector bool int);
757 vector signed int vec_vsubuwm (vector signed int, vector signed int);
758 vector unsigned int vec_vsubuwm (vector bool int, vector unsigned int);
759 vector unsigned int vec_vsubuwm (vector unsigned int, vector bool int);
760 vector unsigned int vec_vsubuwm (vector unsigned int, vector unsigned int);
762 vector unsigned int vec_vsubuws (vector bool int, vector unsigned int);
763 vector unsigned int vec_vsubuws (vector unsigned int, vector bool int);
764 vector unsigned int vec_vsubuws (vector unsigned int, vector unsigned int);
766 vector signed int vec_vsum4sbs (vector signed char, vector signed int);
768 vector signed int vec_vsum4shs (vector signed short, vector signed int);
770 vector unsigned int vec_vsum4ubs (vector unsigned char, vector unsigned int);
772 vector unsigned int vec_vupkhpx (vector pixel);
774 vector bool short vec_vupkhsb (vector bool char);
775 vector signed short vec_vupkhsb (vector signed char);
777 vector bool int vec_vupkhsh (vector bool short);
778 vector signed int vec_vupkhsh (vector signed short);
780 vector unsigned int vec_vupklpx (vector pixel);
782 vector bool short vec_vupklsb (vector bool char);
783 vector signed short vec_vupklsb (vector signed char);
785 vector bool int vec_vupklsh (vector bool short);
786 vector signed int vec_vupklsh (vector signed short);
788 .. _powerpc-altivec-built-in-functions-available-on-isa-2.06:
790 PowerPC AltiVec Built-in Functions Available on ISA 2.06
791 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
793 The AltiVec built-in functions described in this section are
794 available on the PowerPC family of processors starting with ISA 2.06
795 or later. These are normally enabled by adding :option:`-mvsx` to the
798 When :option:`-mvsx` is used, the following additional vector types are
803 vector unsigned __int128
804 vector signed __int128
805 vector unsigned long long int
806 vector signed long long int
809 The long long types are only implemented for 64-bit code generation.
811 Only functions excluded from the PVIPR are listed here.
815 void vec_dst (const unsigned long *, int, const int);
816 void vec_dst (const long *, int, const int);
818 void vec_dststt (const unsigned long *, int, const int);
819 void vec_dststt (const long *, int, const int);
821 void vec_dstt (const unsigned long *, int, const int);
822 void vec_dstt (const long *, int, const int);
824 vector unsigned char vec_lvsl (int, const unsigned long *);
825 vector unsigned char vec_lvsl (int, const long *);
827 vector unsigned char vec_lvsr (int, const unsigned long *);
828 vector unsigned char vec_lvsr (int, const long *);
830 vector unsigned char vec_lvsl (int, const double *);
831 vector unsigned char vec_lvsr (int, const double *);
833 vector double vec_vsx_ld (int, const vector double *);
834 vector double vec_vsx_ld (int, const double *);
835 vector float vec_vsx_ld (int, const vector float *);
836 vector float vec_vsx_ld (int, const float *);
837 vector bool int vec_vsx_ld (int, const vector bool int *);
838 vector signed int vec_vsx_ld (int, const vector signed int *);
839 vector signed int vec_vsx_ld (int, const int *);
840 vector signed int vec_vsx_ld (int, const long *);
841 vector unsigned int vec_vsx_ld (int, const vector unsigned int *);
842 vector unsigned int vec_vsx_ld (int, const unsigned int *);
843 vector unsigned int vec_vsx_ld (int, const unsigned long *);
844 vector bool short vec_vsx_ld (int, const vector bool short *);
845 vector pixel vec_vsx_ld (int, const vector pixel *);
846 vector signed short vec_vsx_ld (int, const vector signed short *);
847 vector signed short vec_vsx_ld (int, const short *);
848 vector unsigned short vec_vsx_ld (int, const vector unsigned short *);
849 vector unsigned short vec_vsx_ld (int, const unsigned short *);
850 vector bool char vec_vsx_ld (int, const vector bool char *);
851 vector signed char vec_vsx_ld (int, const vector signed char *);
852 vector signed char vec_vsx_ld (int, const signed char *);
853 vector unsigned char vec_vsx_ld (int, const vector unsigned char *);
854 vector unsigned char vec_vsx_ld (int, const unsigned char *);
856 void vec_vsx_st (vector double, int, vector double *);
857 void vec_vsx_st (vector double, int, double *);
858 void vec_vsx_st (vector float, int, vector float *);
859 void vec_vsx_st (vector float, int, float *);
860 void vec_vsx_st (vector signed int, int, vector signed int *);
861 void vec_vsx_st (vector signed int, int, int *);
862 void vec_vsx_st (vector unsigned int, int, vector unsigned int *);
863 void vec_vsx_st (vector unsigned int, int, unsigned int *);
864 void vec_vsx_st (vector bool int, int, vector bool int *);
865 void vec_vsx_st (vector bool int, int, unsigned int *);
866 void vec_vsx_st (vector bool int, int, int *);
867 void vec_vsx_st (vector signed short, int, vector signed short *);
868 void vec_vsx_st (vector signed short, int, short *);
869 void vec_vsx_st (vector unsigned short, int, vector unsigned short *);
870 void vec_vsx_st (vector unsigned short, int, unsigned short *);
871 void vec_vsx_st (vector bool short, int, vector bool short *);
872 void vec_vsx_st (vector bool short, int, unsigned short *);
873 void vec_vsx_st (vector pixel, int, vector pixel *);
874 void vec_vsx_st (vector pixel, int, unsigned short *);
875 void vec_vsx_st (vector pixel, int, short *);
876 void vec_vsx_st (vector bool short, int, short *);
877 void vec_vsx_st (vector signed char, int, vector signed char *);
878 void vec_vsx_st (vector signed char, int, signed char *);
879 void vec_vsx_st (vector unsigned char, int, vector unsigned char *);
880 void vec_vsx_st (vector unsigned char, int, unsigned char *);
881 void vec_vsx_st (vector bool char, int, vector bool char *);
882 void vec_vsx_st (vector bool char, int, unsigned char *);
883 void vec_vsx_st (vector bool char, int, signed char *);
885 vector double vec_xxpermdi (vector double, vector double, const int);
886 vector float vec_xxpermdi (vector float, vector float, const int);
887 vector long long vec_xxpermdi (vector long long, vector long long, const int);
888 vector unsigned long long vec_xxpermdi (vector unsigned long long,
889 vector unsigned long long, const int);
890 vector int vec_xxpermdi (vector int, vector int, const int);
891 vector unsigned int vec_xxpermdi (vector unsigned int,
892 vector unsigned int, const int);
893 vector short vec_xxpermdi (vector short, vector short, const int);
894 vector unsigned short vec_xxpermdi (vector unsigned short,
895 vector unsigned short, const int);
896 vector signed char vec_xxpermdi (vector signed char, vector signed char,
898 vector unsigned char vec_xxpermdi (vector unsigned char,
899 vector unsigned char, const int);
901 vector double vec_xxsldi (vector double, vector double, int);
902 vector float vec_xxsldi (vector float, vector float, int);
903 vector long long vec_xxsldi (vector long long, vector long long, int);
904 vector unsigned long long vec_xxsldi (vector unsigned long long,
905 vector unsigned long long, int);
906 vector int vec_xxsldi (vector int, vector int, int);
907 vector unsigned int vec_xxsldi (vector unsigned int, vector unsigned int, int);
908 vector short vec_xxsldi (vector short, vector short, int);
909 vector unsigned short vec_xxsldi (vector unsigned short,
910 vector unsigned short, int);
911 vector signed char vec_xxsldi (vector signed char, vector signed char, int);
912 vector unsigned char vec_xxsldi (vector unsigned char,
913 vector unsigned char, int);
915 Note that the :samp:`vec_ld` and :samp:`vec_st` built-in functions always
916 generate the AltiVec :samp:`LVX` and :samp:`STVX` instructions even
917 if the VSX instruction set is available. The :samp:`vec_vsx_ld` and
918 :samp:`vec_vsx_st` built-in functions always generate the VSX :samp:`LXVD2X`,
919 :samp:`LXVW4X`, :samp:`STXVD2X`, and :samp:`STXVW4X` instructions.
921 .. _powerpc-altivec-built-in-functions-available-on-isa-2.07:
923 PowerPC AltiVec Built-in Functions Available on ISA 2.07
924 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
926 If the ISA 2.07 additions to the vector/scalar (power8-vector)
927 instruction set are available, the following additional functions are
928 available for both 32-bit and 64-bit targets. For 64-bit targets, you
929 can use :samp:`{vector long}` instead of :samp:`{vector long long}`,
930 :samp:`{vector bool long}` instead of :samp:`{vector bool long long}`, and
931 :samp:`{vector unsigned long}` instead of :samp:`{vector unsigned long long}`.
933 Only functions excluded from the PVIPR are listed here.
937 vector long long vec_vaddudm (vector long long, vector long long);
938 vector long long vec_vaddudm (vector bool long long, vector long long);
939 vector long long vec_vaddudm (vector long long, vector bool long long);
940 vector unsigned long long vec_vaddudm (vector unsigned long long,
941 vector unsigned long long);
942 vector unsigned long long vec_vaddudm (vector bool unsigned long long,
943 vector unsigned long long);
944 vector unsigned long long vec_vaddudm (vector unsigned long long,
945 vector bool unsigned long long);
947 vector long long vec_vclz (vector long long);
948 vector unsigned long long vec_vclz (vector unsigned long long);
949 vector int vec_vclz (vector int);
950 vector unsigned int vec_vclz (vector int);
951 vector short vec_vclz (vector short);
952 vector unsigned short vec_vclz (vector unsigned short);
953 vector signed char vec_vclz (vector signed char);
954 vector unsigned char vec_vclz (vector unsigned char);
956 vector signed char vec_vclzb (vector signed char);
957 vector unsigned char vec_vclzb (vector unsigned char);
959 vector long long vec_vclzd (vector long long);
960 vector unsigned long long vec_vclzd (vector unsigned long long);
962 vector short vec_vclzh (vector short);
963 vector unsigned short vec_vclzh (vector unsigned short);
965 vector int vec_vclzw (vector int);
966 vector unsigned int vec_vclzw (vector int);
968 vector signed char vec_vgbbd (vector signed char);
969 vector unsigned char vec_vgbbd (vector unsigned char);
971 vector long long vec_vmaxsd (vector long long, vector long long);
973 vector unsigned long long vec_vmaxud (vector unsigned long long,
974 unsigned vector long long);
976 vector long long vec_vminsd (vector long long, vector long long);
978 vector unsigned long long vec_vminud (vector long long, vector long long);
980 vector int vec_vpksdss (vector long long, vector long long);
981 vector unsigned int vec_vpksdss (vector long long, vector long long);
983 vector unsigned int vec_vpkudus (vector unsigned long long,
984 vector unsigned long long);
986 vector int vec_vpkudum (vector long long, vector long long);
987 vector unsigned int vec_vpkudum (vector unsigned long long,
988 vector unsigned long long);
989 vector bool int vec_vpkudum (vector bool long long, vector bool long long);
991 vector long long vec_vpopcnt (vector long long);
992 vector unsigned long long vec_vpopcnt (vector unsigned long long);
993 vector int vec_vpopcnt (vector int);
994 vector unsigned int vec_vpopcnt (vector int);
995 vector short vec_vpopcnt (vector short);
996 vector unsigned short vec_vpopcnt (vector unsigned short);
997 vector signed char vec_vpopcnt (vector signed char);
998 vector unsigned char vec_vpopcnt (vector unsigned char);
1000 vector signed char vec_vpopcntb (vector signed char);
1001 vector unsigned char vec_vpopcntb (vector unsigned char);
1003 vector long long vec_vpopcntd (vector long long);
1004 vector unsigned long long vec_vpopcntd (vector unsigned long long);
1006 vector short vec_vpopcnth (vector short);
1007 vector unsigned short vec_vpopcnth (vector unsigned short);
1009 vector int vec_vpopcntw (vector int);
1010 vector unsigned int vec_vpopcntw (vector int);
1012 vector long long vec_vrld (vector long long, vector unsigned long long);
1013 vector unsigned long long vec_vrld (vector unsigned long long,
1014 vector unsigned long long);
1016 vector long long vec_vsld (vector long long, vector unsigned long long);
1017 vector long long vec_vsld (vector unsigned long long,
1018 vector unsigned long long);
1020 vector long long vec_vsrad (vector long long, vector unsigned long long);
1021 vector unsigned long long vec_vsrad (vector unsigned long long,
1022 vector unsigned long long);
1024 vector long long vec_vsrd (vector long long, vector unsigned long long);
1025 vector unsigned long long char vec_vsrd (vector unsigned long long,
1026 vector unsigned long long);
1028 vector long long vec_vsubudm (vector long long, vector long long);
1029 vector long long vec_vsubudm (vector bool long long, vector long long);
1030 vector long long vec_vsubudm (vector long long, vector bool long long);
1031 vector unsigned long long vec_vsubudm (vector unsigned long long,
1032 vector unsigned long long);
1033 vector unsigned long long vec_vsubudm (vector bool long long,
1034 vector unsigned long long);
1035 vector unsigned long long vec_vsubudm (vector unsigned long long,
1036 vector bool long long);
1038 vector long long vec_vupkhsw (vector int);
1039 vector unsigned long long vec_vupkhsw (vector unsigned int);
1041 vector long long vec_vupklsw (vector int);
1042 vector unsigned long long vec_vupklsw (vector int);
1044 If the ISA 2.07 additions to the vector/scalar (power8-vector)
1045 instruction set are available, the following additional functions are
1046 available for 64-bit targets. New vector types
1047 (:samp:`{vector __int128}` and :samp:`{vector __uint128}`) are available
1048 to hold the :samp:`{__int128}` and :samp:`{__uint128}` types to use these
1051 The normal vector extract, and set operations work on
1052 :samp:`{vector __int128}` and :samp:`{vector __uint128}` types,
1053 but the index value must be 0.
1055 Only functions excluded from the PVIPR are listed here.
1059 vector __int128 vec_vaddcuq (vector __int128, vector __int128);
1060 vector __uint128 vec_vaddcuq (vector __uint128, vector __uint128);
1062 vector __int128 vec_vadduqm (vector __int128, vector __int128);
1063 vector __uint128 vec_vadduqm (vector __uint128, vector __uint128);
1065 vector __int128 vec_vaddecuq (vector __int128, vector __int128,
1067 vector __uint128 vec_vaddecuq (vector __uint128, vector __uint128,
1070 vector __int128 vec_vaddeuqm (vector __int128, vector __int128,
1072 vector __uint128 vec_vaddeuqm (vector __uint128, vector __uint128,
1075 vector __int128 vec_vsubecuq (vector __int128, vector __int128,
1077 vector __uint128 vec_vsubecuq (vector __uint128, vector __uint128,
1080 vector __int128 vec_vsubeuqm (vector __int128, vector __int128,
1082 vector __uint128 vec_vsubeuqm (vector __uint128, vector __uint128,
1085 vector __int128 vec_vsubcuq (vector __int128, vector __int128);
1086 vector __uint128 vec_vsubcuq (vector __uint128, vector __uint128);
1088 __int128 vec_vsubuqm (__int128, __int128);
1089 __uint128 vec_vsubuqm (__uint128, __uint128);
1091 vector __int128 __builtin_bcdadd (vector __int128, vector __int128, const int);
1092 vector unsigned char __builtin_bcdadd (vector unsigned char, vector unsigned char,
1094 int __builtin_bcdadd_lt (vector __int128, vector __int128, const int);
1095 int __builtin_bcdadd_lt (vector unsigned char, vector unsigned char, const int);
1096 int __builtin_bcdadd_eq (vector __int128, vector __int128, const int);
1097 int __builtin_bcdadd_eq (vector unsigned char, vector unsigned char, const int);
1098 int __builtin_bcdadd_gt (vector __int128, vector __int128, const int);
1099 int __builtin_bcdadd_gt (vector unsigned char, vector unsigned char, const int);
1100 int __builtin_bcdadd_ov (vector __int128, vector __int128, const int);
1101 int __builtin_bcdadd_ov (vector unsigned char, vector unsigned char, const int);
1103 vector __int128 __builtin_bcdsub (vector __int128, vector __int128, const int);
1104 vector unsigned char __builtin_bcdsub (vector unsigned char, vector unsigned char,
1106 int __builtin_bcdsub_lt (vector __int128, vector __int128, const int);
1107 int __builtin_bcdsub_lt (vector unsigned char, vector unsigned char, const int);
1108 int __builtin_bcdsub_eq (vector __int128, vector __int128, const int);
1109 int __builtin_bcdsub_eq (vector unsigned char, vector unsigned char, const int);
1110 int __builtin_bcdsub_gt (vector __int128, vector __int128, const int);
1111 int __builtin_bcdsub_gt (vector unsigned char, vector unsigned char, const int);
1112 int __builtin_bcdsub_ov (vector __int128, vector __int128, const int);
1113 int __builtin_bcdsub_ov (vector unsigned char, vector unsigned char, const int);
1115 .. _powerpc-altivec-built-in-functions-available-on-isa-3.0:
1117 PowerPC AltiVec Built-in Functions Available on ISA 3.0
1118 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1120 The following additional built-in functions are also available for the
1121 PowerPC family of processors, starting with ISA 3.0
1122 (:option:`-mcpu=power9`) or later.
1124 Only instructions excluded from the PVIPR are listed here.
1128 unsigned int scalar_extract_exp (double source);
1129 unsigned long long int scalar_extract_exp (__ieee128 source);
1131 unsigned long long int scalar_extract_sig (double source);
1132 unsigned __int128 scalar_extract_sig (__ieee128 source);
1134 double scalar_insert_exp (unsigned long long int significand,
1135 unsigned long long int exponent);
1136 double scalar_insert_exp (double significand, unsigned long long int exponent);
1138 ieee_128 scalar_insert_exp (unsigned __int128 significand,
1139 unsigned long long int exponent);
1140 ieee_128 scalar_insert_exp (ieee_128 significand, unsigned long long int exponent);
1142 int scalar_cmp_exp_gt (double arg1, double arg2);
1143 int scalar_cmp_exp_lt (double arg1, double arg2);
1144 int scalar_cmp_exp_eq (double arg1, double arg2);
1145 int scalar_cmp_exp_unordered (double arg1, double arg2);
1147 bool scalar_test_data_class (float source, const int condition);
1148 bool scalar_test_data_class (double source, const int condition);
1149 bool scalar_test_data_class (__ieee128 source, const int condition);
1151 bool scalar_test_neg (float source);
1152 bool scalar_test_neg (double source);
1153 bool scalar_test_neg (__ieee128 source);
1155 The ``scalar_extract_exp`` and ``scalar_extract_sig``
1156 functions require a 64-bit environment supporting ISA 3.0 or later.
1157 The ``scalar_extract_exp`` and ``scalar_extract_sig`` built-in
1158 functions return the significand and the biased exponent value
1159 respectively of their ``source`` arguments.
1160 When supplied with a 64-bit ``source`` argument, the
1161 result returned by ``scalar_extract_sig`` has
1162 the ``0x0010000000000000`` bit set if the
1163 function's ``source`` argument is in normalized form.
1164 Otherwise, this bit is set to 0.
1165 When supplied with a 128-bit ``source`` argument, the
1166 ``0x00010000000000000000000000000000`` bit of the result is
1168 Note that the sign of the significand is not represented in the result
1169 returned from the ``scalar_extract_sig`` function. Use the
1170 ``scalar_test_neg`` function to test the sign of its ``double``
1173 The ``scalar_insert_exp``
1174 functions require a 64-bit environment supporting ISA 3.0 or later.
1175 When supplied with a 64-bit first argument, the
1176 ``scalar_insert_exp`` built-in function returns a double-precision
1177 floating point value that is constructed by assembling the values of its
1178 ``significand`` and ``exponent`` arguments. The sign of the
1179 result is copied from the most significant bit of the
1180 ``significand`` argument. The significand and exponent components
1181 of the result are composed of the least significant 11 bits of the
1182 ``exponent`` argument and the least significant 52 bits of the
1183 ``significand`` argument respectively.
1185 When supplied with a 128-bit first argument, the
1186 ``scalar_insert_exp`` built-in function returns a quad-precision
1187 ieee floating point value. The sign bit of the result is copied from
1188 the most significant bit of the ``significand`` argument.
1189 The significand and exponent components of the result are composed of
1190 the least significant 15 bits of the ``exponent`` argument and the
1191 least significant 112 bits of the ``significand`` argument respectively.
1193 The ``scalar_cmp_exp_gt``, ``scalar_cmp_exp_lt``,
1194 ``scalar_cmp_exp_eq``, and ``scalar_cmp_exp_unordered`` built-in
1195 functions return a non-zero value if ``arg1`` is greater than, less
1196 than, equal to, or not comparable to ``arg2`` respectively. The
1197 arguments are not comparable if one or the other equals NaN (not a
1200 The ``scalar_test_data_class`` built-in function returns 1
1201 if any of the condition tests enabled by the value of the
1202 ``condition`` variable are true, and 0 otherwise. The
1203 ``condition`` argument must be a compile-time constant integer with
1204 value not exceeding 127. The
1205 ``condition`` argument is encoded as a bitmask with each bit
1206 enabling the testing of a different condition, as characterized by the
1212 0x20 Test for +Infinity
1213 0x10 Test for -Infinity
1216 0x02 Test for +Denormal
1217 0x01 Test for -Denormal
1219 The ``scalar_test_neg`` built-in function returns 1 if its
1220 ``source`` argument holds a negative value, 0 otherwise.
1222 The following built-in functions are also available for the PowerPC family
1223 of processors, starting with ISA 3.0 or later
1224 (:option:`-mcpu=power9`). These string functions are described
1225 separately in order to group the descriptions closer to the function
1228 Only functions excluded from the PVIPR are listed here.
1232 int vec_all_nez (vector signed char, vector signed char);
1233 int vec_all_nez (vector unsigned char, vector unsigned char);
1234 int vec_all_nez (vector signed short, vector signed short);
1235 int vec_all_nez (vector unsigned short, vector unsigned short);
1236 int vec_all_nez (vector signed int, vector signed int);
1237 int vec_all_nez (vector unsigned int, vector unsigned int);
1239 int vec_any_eqz (vector signed char, vector signed char);
1240 int vec_any_eqz (vector unsigned char, vector unsigned char);
1241 int vec_any_eqz (vector signed short, vector signed short);
1242 int vec_any_eqz (vector unsigned short, vector unsigned short);
1243 int vec_any_eqz (vector signed int, vector signed int);
1244 int vec_any_eqz (vector unsigned int, vector unsigned int);
1246 signed char vec_xlx (unsigned int index, vector signed char data);
1247 unsigned char vec_xlx (unsigned int index, vector unsigned char data);
1248 signed short vec_xlx (unsigned int index, vector signed short data);
1249 unsigned short vec_xlx (unsigned int index, vector unsigned short data);
1250 signed int vec_xlx (unsigned int index, vector signed int data);
1251 unsigned int vec_xlx (unsigned int index, vector unsigned int data);
1252 float vec_xlx (unsigned int index, vector float data);
1254 signed char vec_xrx (unsigned int index, vector signed char data);
1255 unsigned char vec_xrx (unsigned int index, vector unsigned char data);
1256 signed short vec_xrx (unsigned int index, vector signed short data);
1257 unsigned short vec_xrx (unsigned int index, vector unsigned short data);
1258 signed int vec_xrx (unsigned int index, vector signed int data);
1259 unsigned int vec_xrx (unsigned int index, vector unsigned int data);
1260 float vec_xrx (unsigned int index, vector float data);
1262 The ``vec_all_nez``, ``vec_any_eqz``, and ``vec_cmpnez``
1263 perform pairwise comparisons between the elements at the same
1264 positions within their two vector arguments.
1265 The ``vec_all_nez`` function returns a
1266 non-zero value if and only if all pairwise comparisons are not
1267 equal and no element of either vector argument contains a zero.
1268 The ``vec_any_eqz`` function returns a
1269 non-zero value if and only if at least one pairwise comparison is equal
1270 or if at least one element of either vector argument contains a zero.
1271 The ``vec_cmpnez`` function returns a vector of the same type as
1272 its two arguments, within which each element consists of all ones to
1273 denote that either the corresponding elements of the incoming arguments are
1274 not equal or that at least one of the corresponding elements contains
1275 zero. Otherwise, the element of the returned vector contains all zeros.
1277 The ``vec_xlx`` and ``vec_xrx`` functions extract the single
1278 element selected by the ``index`` argument from the vector
1279 represented by the ``data`` argument. The ``index`` argument
1280 always specifies a byte offset, regardless of the size of the vector
1281 element. With ``vec_xlx``, ``index`` is the offset of the first
1282 byte of the element to be extracted. With ``vec_xrx``, ``index``
1283 represents the last byte of the element to be extracted, measured
1284 from the right end of the vector. In other words, the last byte of
1285 the element to be extracted is found at position ``(15 - index)``.
1286 There is no requirement that ``index`` be a multiple of the vector
1287 element size. However, if the size of the vector element added to
1288 ``index`` is greater than 15, the content of the returned value is
1291 The following functions are also available if the ISA 3.0 instruction
1292 set additions (:option:`-mcpu=power9`) are available.
1294 Only functions excluded from the PVIPR are listed here.
1298 vector long long vec_vctz (vector long long);
1299 vector unsigned long long vec_vctz (vector unsigned long long);
1300 vector int vec_vctz (vector int);
1301 vector unsigned int vec_vctz (vector int);
1302 vector short vec_vctz (vector short);
1303 vector unsigned short vec_vctz (vector unsigned short);
1304 vector signed char vec_vctz (vector signed char);
1305 vector unsigned char vec_vctz (vector unsigned char);
1307 vector signed char vec_vctzb (vector signed char);
1308 vector unsigned char vec_vctzb (vector unsigned char);
1310 vector long long vec_vctzd (vector long long);
1311 vector unsigned long long vec_vctzd (vector unsigned long long);
1313 vector short vec_vctzh (vector short);
1314 vector unsigned short vec_vctzh (vector unsigned short);
1316 vector int vec_vctzw (vector int);
1317 vector unsigned int vec_vctzw (vector int);
1319 vector int vec_vprtyb (vector int);
1320 vector unsigned int vec_vprtyb (vector unsigned int);
1321 vector long long vec_vprtyb (vector long long);
1322 vector unsigned long long vec_vprtyb (vector unsigned long long);
1324 vector int vec_vprtybw (vector int);
1325 vector unsigned int vec_vprtybw (vector unsigned int);
1327 vector long long vec_vprtybd (vector long long);
1328 vector unsigned long long vec_vprtybd (vector unsigned long long);
1330 On 64-bit targets, if the ISA 3.0 additions (:option:`-mcpu=power9`)
1335 vector long vec_vprtyb (vector long);
1336 vector unsigned long vec_vprtyb (vector unsigned long);
1337 vector __int128 vec_vprtyb (vector __int128);
1338 vector __uint128 vec_vprtyb (vector __uint128);
1340 vector long vec_vprtybd (vector long);
1341 vector unsigned long vec_vprtybd (vector unsigned long);
1343 vector __int128 vec_vprtybq (vector __int128);
1344 vector __uint128 vec_vprtybd (vector __uint128);
1346 The following built-in functions are available for the PowerPC family
1347 of processors, starting with ISA 3.0 or later (:option:`-mcpu=power9`).
1349 Only functions excluded from the PVIPR are listed here.
1353 __vector unsigned char
1354 vec_absdb (__vector unsigned char arg1, __vector unsigned char arg2);
1355 __vector unsigned short
1356 vec_absdh (__vector unsigned short arg1, __vector unsigned short arg2);
1357 __vector unsigned int
1358 vec_absdw (__vector unsigned int arg1, __vector unsigned int arg2);
1360 The ``vec_absd``, ``vec_absdb``, ``vec_absdh``, and
1361 ``vec_absdw`` built-in functions each computes the absolute
1362 differences of the pairs of vector elements supplied in its two vector
1363 arguments, placing the absolute differences into the corresponding
1364 elements of the vector result.
1366 The following built-in functions are available for the PowerPC family
1367 of processors, starting with ISA 3.0 or later (:option:`-mcpu=power9`):
1371 vector unsigned int vec_vrlnm (vector unsigned int, vector unsigned int);
1372 vector unsigned long long vec_vrlnm (vector unsigned long long,
1373 vector unsigned long long);
1375 The result of ``vec_vrlnm`` is obtained by rotating each element
1376 of the first argument vector left and ANDing it with a mask. The
1377 second argument vector contains the mask beginning in bits 11:15,
1378 the mask end in bits 19:23, and the shift count in bits 27:31,
1381 If the cryptographic instructions are enabled (:option:`-mcrypto` or
1382 :option:`-mcpu=power8`), the following builtins are enabled.
1384 Only functions excluded from the PVIPR are listed here.
1388 vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long);
1390 vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long,
1391 vector unsigned long long);
1393 vector unsigned long long __builtin_crypto_vcipherlast
1394 (vector unsigned long long,
1395 vector unsigned long long);
1397 vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long,
1398 vector unsigned long long);
1400 vector unsigned long long __builtin_crypto_vncipherlast (vector unsigned long long,
1401 vector unsigned long long);
1403 vector unsigned char __builtin_crypto_vpermxor (vector unsigned char,
1404 vector unsigned char,
1405 vector unsigned char);
1407 vector unsigned short __builtin_crypto_vpermxor (vector unsigned short,
1408 vector unsigned short,
1409 vector unsigned short);
1411 vector unsigned int __builtin_crypto_vpermxor (vector unsigned int,
1412 vector unsigned int,
1413 vector unsigned int);
1415 vector unsigned long long __builtin_crypto_vpermxor (vector unsigned long long,
1416 vector unsigned long long,
1417 vector unsigned long long);
1419 vector unsigned char __builtin_crypto_vpmsumb (vector unsigned char,
1420 vector unsigned char);
1422 vector unsigned short __builtin_crypto_vpmsumh (vector unsigned short,
1423 vector unsigned short);
1425 vector unsigned int __builtin_crypto_vpmsumw (vector unsigned int,
1426 vector unsigned int);
1428 vector unsigned long long __builtin_crypto_vpmsumd (vector unsigned long long,
1429 vector unsigned long long);
1431 vector unsigned long long __builtin_crypto_vshasigmad (vector unsigned long long,
1434 vector unsigned int __builtin_crypto_vshasigmaw (vector unsigned int, int, int);
1436 The second argument to :samp:`{__builtin_crypto_vshasigmad}` and
1437 :samp:`{__builtin_crypto_vshasigmaw}` must be a constant
1438 integer that is 0 or 1. The third argument to these built-in functions
1439 must be a constant integer in the range of 0 to 15.
1441 The following sign extension builtins are provided:
1445 vector signed int vec_signexti (vector signed char a);
1446 vector signed long long vec_signextll (vector signed char a);
1447 vector signed int vec_signexti (vector signed short a);
1448 vector signed long long vec_signextll (vector signed short a);
1449 vector signed long long vec_signextll (vector signed int a);
1450 vector signed long long vec_signextq (vector signed long long a);
1452 Each element of the result is produced by sign-extending the element of the
1453 input vector that would fall in the least significant portion of the result
1454 element. For example, a sign-extension of a vector signed char to a vector
1455 signed long long will sign extend the rightmost byte of each doubleword.
1457 .. _powerpc-altivec-built-in-functions-available-on-isa-3.1:
1459 PowerPC AltiVec Built-in Functions Available on ISA 3.1
1460 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1462 The following additional built-in functions are also available for the
1463 PowerPC family of processors, starting with ISA 3.1 (:option:`-mcpu=power10`):
1467 vector unsigned long long int
1468 vec_cfuge (vector unsigned long long int, vector unsigned long long int);
1470 Perform a vector centrifuge operation, as if implemented by the
1471 ``vcfuged`` instruction.
1473 .. index:: vec_cfuge
1477 vector unsigned long long int
1478 vec_cntlzm (vector unsigned long long int, vector unsigned long long int);
1480 Perform a vector count leading zeros under bit mask operation, as if
1481 implemented by the ``vclzdm`` instruction.
1483 .. index:: vec_cntlzm
1487 vector unsigned long long int
1488 vec_cnttzm (vector unsigned long long int, vector unsigned long long int);
1490 Perform a vector count trailing zeros under bit mask operation, as if
1491 implemented by the ``vctzdm`` instruction.
1493 .. index:: vec_cnttzm
1498 vec_clrl (vector signed char a, unsigned int n);
1499 vector unsigned char
1500 vec_clrl (vector unsigned char a, unsigned int n);
1502 Clear the left-most ``(16 - n)`` bytes of vector argument ``a``, as if
1503 implemented by the ``vclrlb`` instruction on a big-endian target
1504 and by the ``vclrrb`` instruction on a little-endian target. A
1505 value of ``n`` that is greater than 16 is treated as if it equaled 16.
1512 vec_clrr (vector signed char a, unsigned int n);
1513 vector unsigned char
1514 vec_clrr (vector unsigned char a, unsigned int n);
1516 Clear the right-most ``(16 - n)`` bytes of vector argument ``a``, as if
1517 implemented by the ``vclrrb`` instruction on a big-endian target
1518 and by the ``vclrlb`` instruction on a little-endian target. A
1519 value of ``n`` that is greater than 16 is treated as if it equaled 16.
1525 vector unsigned long long int
1526 vec_gnb (vector unsigned __int128, const unsigned char);
1528 Perform a 128-bit vector gather operation, as if implemented by the
1529 ``vgnb`` instruction. The second argument must be a literal
1530 integer value between 2 and 7 inclusive.
1538 vector unsigned long long int
1539 vec_extractl (vector unsigned char, vector unsigned char, unsigned int);
1540 vector unsigned long long int
1541 vec_extractl (vector unsigned short, vector unsigned short, unsigned int);
1542 vector unsigned long long int
1543 vec_extractl (vector unsigned int, vector unsigned int, unsigned int);
1544 vector unsigned long long int
1545 vec_extractl (vector unsigned long long, vector unsigned long long, unsigned int);
1547 Extract an element from two concatenated vectors starting at the given byte index
1548 in natural-endian order, and place it zero-extended in doubleword 1 of the result
1549 according to natural element order. If the byte index is out of range for the
1550 data type, the intrinsic will be rejected.
1551 For little-endian, this output will match the placement by the hardware
1552 instruction, i.e., dword[0] in RTL notation. For big-endian, an additional
1553 instruction is needed to move it from the "left" doubleword to the "right" one.
1554 For little-endian, semantics matching the ``vextdubvrx``,
1555 ``vextduhvrx``, ``vextduwvrx`` instruction will be generated, while for
1556 big-endian, semantics matching the ``vextdubvlx``, ``vextduhvlx``,
1557 ``vextduwvlx`` instructions
1558 will be generated. Note that some fairly anomalous results can be generated if
1559 the byte index is not aligned on an element boundary for the element being
1560 extracted. This is a limitation of the bi-endian vector programming model is
1561 consistent with the limitation on ``vec_perm``.
1563 .. index:: vec_extractl
1567 vector unsigned long long intvec_extracth (vector unsigned char, vector unsigned char, unsigned int);
1568 vector unsigned long long intvec_extracth (vector unsigned short, vector unsigned short,unsigned int);
1569 vector unsigned long long intvec_extracth (vector unsigned int, vector unsigned int, unsigned int);
1570 vector unsigned long long intvec_extracth (vector unsigned long long, vector unsigned long long,unsigned int);
1572 Extract an element from two concatenated vectors starting at the given byte
1573 index. The index is based on big endian order for a little endian system.
1574 Similarly, the index is based on little endian order for a big endian system.
1575 The extraced elements are zero-extended and put in doubleword 1
1576 according to natural element order. If the byte index is out of range for the
1577 data type, the intrinsic will be rejected. For little-endian, this output
1578 will match the placement by the hardware instruction (vextdubvrx, vextduhvrx,
1579 vextduwvrx, vextddvrx) i.e., dword[0] in RTL
1580 notation. For big-endian, an additional instruction is needed to move it
1581 from the "left" doubleword to the "right" one. For little-endian, semantics
1582 matching the ``vextdubvlx``, ``vextduhvlx``, ``vextduwvlx``
1583 instructions will be generated, while for big-endian, semantics matching the
1584 ``vextdubvrx``, ``vextduhvrx``, ``vextduwvrx`` instructions will
1585 be generated. Note that some fairly anomalous
1586 results can be generated if the byte index is not aligned on the
1587 element boundary for the element being extracted. This is a
1588 limitation of the bi-endian vector programming model consistent with the
1589 limitation on ``vec_perm``.
1591 .. index:: vec_extracth
1595 vector unsigned long long int
1596 vec_pdep (vector unsigned long long int, vector unsigned long long int);
1598 Perform a vector parallel bits deposit operation, as if implemented by
1599 the ``vpdepd`` instruction.
1607 vector unsigned charvec_insertl (unsigned char, vector unsigned char, unsigned int);
1608 vector unsigned shortvec_insertl (unsigned short, vector unsigned short, unsigned int);
1609 vector unsigned intvec_insertl (unsigned int, vector unsigned int, unsigned int);
1610 vector unsigned long longvec_insertl (unsigned long long, vector unsigned long long,unsigned int);
1611 vector unsigned charvec_insertl (vector unsigned char, vector unsigned char, unsigned int;
1612 vector unsigned shortvec_insertl (vector unsigned short, vector unsigned short,unsigned int);
1613 vector unsigned intvec_insertl (vector unsigned int, vector unsigned int, unsigned int);
1615 Let src be the first argument, when the first argument is a scalar, or the
1616 rightmost element of the left doubleword of the first argument, when the first
1617 argument is a vector. Insert the source into the destination at the position
1618 given by the third argument, using natural element order in the second
1619 argument. The rest of the second argument is unchanged. If the byte
1620 index is greater than 14 for halfwords, greater than 12 for words, or
1621 greater than 8 for doublewords the result is undefined. For little-endian,
1622 the generated code will be semantically equivalent to ``vins[bhwd]rx``
1623 instructions. Similarly for big-endian it will be semantically equivalent
1624 to ``vins[bhwd]lx``. Note that some fairly anomalous results can be
1625 generated if the byte index is not aligned on an element boundary for the
1626 type of element being inserted.
1628 .. index:: vec_insertl
1632 vector unsigned charvec_inserth (unsigned char, vector unsigned char, unsigned int);
1633 vector unsigned shortvec_inserth (unsigned short, vector unsigned short, unsigned int);
1634 vector unsigned intvec_inserth (unsigned int, vector unsigned int, unsigned int);
1635 vector unsigned long longvec_inserth (unsigned long long, vector unsigned long long,unsigned int);
1636 vector unsigned charvec_inserth (vector unsigned char, vector unsigned char, unsigned int);
1637 vector unsigned shortvec_inserth (vector unsigned short, vector unsigned short,unsigned int);
1638 vector unsigned intvec_inserth (vector unsigned int, vector unsigned int, unsigned int);
1640 Let src be the first argument, when the first argument is a scalar, or the
1641 rightmost element of the first argument, when the first argument is a vector.
1642 Insert src into the second argument at the position identified by the third
1643 argument, using opposite element order in the second argument, and leaving the
1644 rest of the second argument unchanged. If the byte index is greater than 14
1645 for halfwords, 12 for words, or 8 for doublewords, the intrinsic will be
1646 rejected. Note that the underlying hardware instruction uses the same register
1647 for the second argument and the result.
1648 For little-endian, the code generation will be semantically equivalent to
1649 ``vins[bhwd]lx``, while for big-endian it will be semantically equivalent to
1651 Note that some fairly anomalous results can be generated if the byte index is
1652 not aligned on an element boundary for the sort of element being inserted.
1654 .. index:: vec_inserth
1656 Vector Replace Element
1660 vector signed int vec_replace_elt (vector signed int, signed int,const int);
1661 vector unsigned int vec_replace_elt (vector unsigned int,unsigned int, const int);
1662 vector float vec_replace_elt (vector float, float, const int);
1663 vector signed long long vec_replace_elt (vector signed long long,signed long long, const int);
1664 vector unsigned long long vec_replace_elt (vector unsigned long long,unsigned long long, const int);
1665 vector double rec_replace_elt (vector double, double, const int);
1667 The third argument (constrained to [0,3]) identifies the natural-endian
1668 element number of the first argument that will be replaced by the second
1669 argument to produce the result. The other elements of the first argument will
1670 remain unchanged in the result.
1672 If it's desirable to insert a word at an unaligned position, use
1673 vec_replace_unaligned instead.
1675 .. index:: vec_replace_element
1677 Vector Replace Unaligned
1681 vector unsigned char vec_replace_unaligned (vector unsigned char,signed int, const int);
1682 vector unsigned char vec_replace_unaligned (vector unsigned char,unsigned int, const int);
1683 vector unsigned char vec_replace_unaligned (vector unsigned char,float, const int);
1684 vector unsigned char vec_replace_unaligned (vector unsigned char,signed long long, const int);
1685 vector unsigned char vec_replace_unaligned (vector unsigned char,unsigned long long, const int);
1686 vector unsigned char vec_replace_unaligned (vector unsigned char,double, const int);
1688 The second argument replaces a portion of the first argument to produce the
1689 result, with the rest of the first argument unchanged in the result. The
1690 third argument identifies the byte index (using left-to-right, or big-endian
1691 order) where the high-order byte of the second argument will be placed, with
1692 the remaining bytes of the second argument placed naturally "to the right"
1693 of the high-order byte.
1695 The programmer is responsible for understanding the endianness issues involved
1696 with the first argument and the result.
1698 .. index:: vec_replace_unaligned
1700 Vector Shift Left Double Bit Immediate
1704 vector signed char vec_sldb (vector signed char, vector signed char,const unsigned int);
1705 vector unsigned char vec_sldb (vector unsigned char,vector unsigned char, const unsigned int);
1706 vector signed short vec_sldb (vector signed short, vector signed short,const unsigned int);
1707 vector unsigned short vec_sldb (vector unsigned short,vector unsigned short, const unsigned int);
1708 vector signed int vec_sldb (vector signed int, vector signed int,const unsigned int);
1709 vector unsigned int vec_sldb (vector unsigned int, vector unsigned int,const unsigned int);
1710 vector signed long long vec_sldb (vector signed long long,vector signed long long, const unsigned int);
1711 vector unsigned long long vec_sldb (vector unsigned long long,vector unsigned long long, const unsigned int);
1713 Shift the combined input vectors left by the amount specified by the low-order
1714 three bits of the third argument, and return the leftmost remaining 128 bits.
1715 Code using this instruction must be endian-aware.
1719 Vector Shift Right Double Bit Immediate
1723 vector signed char vec_srdb (vector signed char, vector signed char,const unsigned int);
1724 vector unsigned char vec_srdb (vector unsigned char, vector unsigned char,const unsigned int);
1725 vector signed short vec_srdb (vector signed short, vector signed short,const unsigned int);
1726 vector unsigned short vec_srdb (vector unsigned short, vector unsigned short,const unsigned int);
1727 vector signed int vec_srdb (vector signed int, vector signed int,const unsigned int);
1728 vector unsigned int vec_srdb (vector unsigned int, vector unsigned int,const unsigned int);
1729 vector signed long long vec_srdb (vector signed long long,vector signed long long, const unsigned int);
1730 vector unsigned long long vec_srdb (vector unsigned long long,vector unsigned long long, const unsigned int);
1732 Shift the combined input vectors right by the amount specified by the low-order
1733 three bits of the third argument, and return the remaining 128 bits. Code
1734 using this built-in must be endian-aware.
1742 vector signed int vec_splati (const signed int);
1743 vector float vec_splati (const float);
1745 Splat a 32-bit immediate into a vector of words.
1747 .. index:: vec_splati
1751 vector double vec_splatid (const float);
1753 Convert a single precision floating-point value to double-precision and splat
1754 the result to a vector of double-precision floats.
1756 .. index:: vec_splatid
1760 vector signed int vec_splati_ins (vector signed int,const unsigned int, const signed int);
1761 vector unsigned int vec_splati_ins (vector unsigned int,const unsigned int, const unsigned int);
1762 vector float vec_splati_ins (vector float, const unsigned int,const float);
1764 Argument 2 must be either 0 or 1. Splat the value of argument 3 into the word
1765 identified by argument 2 of each doubleword of argument 1 and return the
1766 result. The other words of argument 1 are unchanged.
1768 .. index:: vec_splati_ins
1770 Vector Blend Variable
1774 vector signed char vec_blendv (vector signed char, vector signed char,vector unsigned char);
1775 vector unsigned char vec_blendv (vector unsigned char,vector unsigned char, vector unsigned char);
1776 vector signed short vec_blendv (vector signed short,vector signed short, vector unsigned short);
1777 vector unsigned short vec_blendv (vector unsigned short,vector unsigned short, vector unsigned short);
1778 vector signed int vec_blendv (vector signed int, vector signed int,vector unsigned int);
1779 vector unsigned int vec_blendv (vector unsigned int,vector unsigned int, vector unsigned int);
1780 vector signed long long vec_blendv (vector signed long long,vector signed long long, vector unsigned long long);
1781 vector unsigned long long vec_blendv (vector unsigned long long,vector unsigned long long, vector unsigned long long);
1782 vector float vec_blendv (vector float, vector float,vector unsigned int);
1783 vector double vec_blendv (vector double, vector double,vector unsigned long long);
1785 Blend the first and second argument vectors according to the sign bits of the
1786 corresponding elements of the third argument vector. This is similar to the
1787 ``vsel`` and ``xxsel`` instructions but for bigger elements.
1789 .. index:: vec_blendv
1791 Vector Permute Extended
1795 vector signed char vec_permx (vector signed char, vector signed char,vector unsigned char, const int);
1796 vector unsigned char vec_permx (vector unsigned char,vector unsigned char, vector unsigned char, const int);
1797 vector signed short vec_permx (vector signed short,vector signed short, vector unsigned char, const int);
1798 vector unsigned short vec_permx (vector unsigned short,vector unsigned short, vector unsigned char, const int);
1799 vector signed int vec_permx (vector signed int, vector signed int,vector unsigned char, const int);
1800 vector unsigned int vec_permx (vector unsigned int,vector unsigned int, vector unsigned char, const int);
1801 vector signed long long vec_permx (vector signed long long,vector signed long long, vector unsigned char, const int);
1802 vector unsigned long long vec_permx (vector unsigned long long,vector unsigned long long, vector unsigned char, const int);
1803 vector float (vector float, vector float, vector unsigned char,const int);
1804 vector double (vector double, vector double, vector unsigned char,const int);
1806 Perform a partial permute of the first two arguments, which form a 32-byte
1807 section of an emulated vector up to 256 bytes wide, using the partial permute
1808 control vector in the third argument. The fourth argument (constrained to
1809 values of 0-7) identifies which 32-byte section of the emulated vector is
1810 contained in the first two arguments.
1812 .. index:: vec_permx
1816 vector unsigned long long int
1817 vec_pext (vector unsigned long long int, vector unsigned long long int);
1819 Perform a vector parallel bit extract operation, as if implemented by
1820 the ``vpextd`` instruction.
1826 vector unsigned char vec_stril (vector unsigned char);
1827 vector signed char vec_stril (vector signed char);
1828 vector unsigned short vec_stril (vector unsigned short);
1829 vector signed short vec_stril (vector signed short);
1831 Isolate the left-most non-zero elements of the incoming vector argument,
1832 replacing all elements to the right of the left-most zero element
1833 found within the argument with zero. The typical implementation uses
1834 the ``vstribl`` or ``vstrihl`` instruction on big-endian targets
1835 and uses the ``vstribr`` or ``vstrihr`` instruction on
1836 little-endian targets.
1838 .. index:: vec_stril
1842 int vec_stril_p (vector unsigned char);
1843 int vec_stril_p (vector signed char);
1844 int short vec_stril_p (vector unsigned short);
1845 int vec_stril_p (vector signed short);
1847 Return a non-zero value if and only if the argument contains a zero
1848 element. The typical implementation uses
1849 the ``vstribl.`` or ``vstrihl.`` instruction on big-endian targets
1850 and uses the ``vstribr.`` or ``vstrihr.`` instruction on
1851 little-endian targets. Choose this built-in to check for presence of
1852 zero element if the same argument is also passed to ``vec_stril``.
1854 .. index:: vec_stril_p
1858 vector unsigned char vec_strir (vector unsigned char);
1859 vector signed char vec_strir (vector signed char);
1860 vector unsigned short vec_strir (vector unsigned short);
1861 vector signed short vec_strir (vector signed short);
1863 Isolate the right-most non-zero elements of the incoming vector argument,
1864 replacing all elements to the left of the right-most zero element
1865 found within the argument with zero. The typical implementation uses
1866 the ``vstribr`` or ``vstrihr`` instruction on big-endian targets
1867 and uses the ``vstribl`` or ``vstrihl`` instruction on
1868 little-endian targets.
1870 .. index:: vec_strir
1874 int vec_strir_p (vector unsigned char);
1875 int vec_strir_p (vector signed char);
1876 int short vec_strir_p (vector unsigned short);
1877 int vec_strir_p (vector signed short);
1879 Return a non-zero value if and only if the argument contains a zero
1880 element. The typical implementation uses
1881 the ``vstribr.`` or ``vstrihr.`` instruction on big-endian targets
1882 and uses the ``vstribl.`` or ``vstrihl.`` instruction on
1883 little-endian targets. Choose this built-in to check for presence of
1884 zero element if the same argument is also passed to ``vec_strir``.
1886 .. index:: vec_strir_p
1890 vector unsigned charvec_ternarylogic (vector unsigned char, vector unsigned char, vector unsigned char, const unsigned int);
1891 vector unsigned shortvec_ternarylogic (vector unsigned short, vector unsigned short, vector unsigned short, const unsigned int);
1892 vector unsigned intvec_ternarylogic (vector unsigned int, vector unsigned int, vector unsigned int, const unsigned int);
1893 vector unsigned long long intvec_ternarylogic (vector unsigned long long int, vector unsigned long long int, vector unsigned long long int, const unsigned int);
1894 vector unsigned __int128vec_ternarylogic (vector unsigned __int128, vector unsigned __int128, vector unsigned __int128, const unsigned int);
1896 Perform a 128-bit vector evaluate operation, as if implemented by the
1897 ``xxeval`` instruction. The fourth argument must be a literal
1898 integer value between 0 and 255 inclusive.
1900 .. index:: vec_ternarylogic
1904 vector unsigned char vec_genpcvm (vector unsigned char, const int);
1905 vector unsigned short vec_genpcvm (vector unsigned short, const int);
1906 vector unsigned int vec_genpcvm (vector unsigned int, const int);
1907 vector unsigned int vec_genpcvm (vector unsigned long long int, const int);
1909 Vector Integer Multiply/Divide/Modulo
1914 vec_mulh (vector signed int a, vector signed int b);
1916 vec_mulh (vector unsigned int a, vector unsigned int b);
1918 For each integer value ``i`` from 0 to 3, do the following. The integer
1919 value in word element ``i`` of a is multiplied by the integer value in word
1920 element ``i`` of b. The high-order 32 bits of the 64-bit product are placed
1921 into word element ``i`` of the vector returned.
1925 vector signed long long
1926 vec_mulh (vector signed long long a, vector signed long long b);
1927 vector unsigned long long
1928 vec_mulh (vector unsigned long long a, vector unsigned long long b);
1930 For each integer value ``i`` from 0 to 1, do the following. The integer
1931 value in doubleword element ``i`` of a is multiplied by the integer value in
1932 doubleword element ``i`` of b. The high-order 64 bits of the 128-bit product
1933 are placed into doubleword element ``i`` of the vector returned.
1937 vector unsigned long long
1938 vec_mul (vector unsigned long long a, vector unsigned long long b);
1939 vector signed long long
1940 vec_mul (vector signed long long a, vector signed long long b);
1942 For each integer value ``i`` from 0 to 1, do the following. The integer
1943 value in doubleword element ``i`` of a is multiplied by the integer value in
1944 doubleword element ``i`` of b. The low-order 64 bits of the 128-bit product
1945 are placed into doubleword element ``i`` of the vector returned.
1950 vec_div (vector signed int a, vector signed int b);
1952 vec_div (vector unsigned int a, vector unsigned int b);
1954 For each integer value ``i`` from 0 to 3, do the following. The integer in
1955 word element ``i`` of a is divided by the integer in word element ``i``
1956 of b. The unique integer quotient is placed into the word element ``i`` of
1957 the vector returned. If an attempt is made to perform any of the divisions
1958 <anything> ÷ 0 then the quotient is undefined.
1962 vector signed long long
1963 vec_div (vector signed long long a, vector signed long long b);
1964 vector unsigned long long
1965 vec_div (vector unsigned long long a, vector unsigned long long b);
1967 For each integer value ``i`` from 0 to 1, do the following. The integer in
1968 doubleword element ``i`` of a is divided by the integer in doubleword
1969 element ``i`` of b. The unique integer quotient is placed into the
1970 doubleword element ``i`` of the vector returned. If an attempt is made to
1971 perform any of the divisions 0x8000_0000_0000_0000 ÷ -1 or <anything> ÷ 0 then
1972 the quotient is undefined.
1977 vec_dive (vector signed int a, vector signed int b);
1979 vec_dive (vector unsigned int a, vector unsigned int b);
1981 For each integer value ``i`` from 0 to 3, do the following. The integer in
1982 word element ``i`` of a is shifted left by 32 bits, then divided by the
1983 integer in word element ``i`` of b. The unique integer quotient is placed
1984 into the word element ``i`` of the vector returned. If the quotient cannot
1985 be represented in 32 bits, or if an attempt is made to perform any of the
1986 divisions <anything> ÷ 0 then the quotient is undefined.
1990 vector signed long long
1991 vec_dive (vector signed long long a, vector signed long long b);
1992 vector unsigned long long
1993 vec_dive (vector unsigned long long a, vector unsigned long long b);
1995 For each integer value ``i`` from 0 to 1, do the following. The integer in
1996 doubleword element ``i`` of a is shifted left by 64 bits, then divided by
1997 the integer in doubleword element ``i`` of b. The unique integer quotient is
1998 placed into the doubleword element ``i`` of the vector returned. If the
1999 quotient cannot be represented in 64 bits, or if an attempt is made to perform
2000 <anything> ÷ 0 then the quotient is undefined.
2005 vec_mod (vector signed int a, vector signed int b);
2007 vec_mod (vector unsigned int a, vector unsigned int b);
2009 For each integer value ``i`` from 0 to 3, do the following. The integer in
2010 word element ``i`` of a is divided by the integer in word element ``i``
2011 of b. The unique integer remainder is placed into the word element ``i`` of
2012 the vector returned. If an attempt is made to perform any of the divisions
2013 0x8000_0000 ÷ -1 or <anything> ÷ 0 then the remainder is undefined.
2017 vector signed long long
2018 vec_mod (vector signed long long a, vector signed long long b);
2019 vector unsigned long long
2020 vec_mod (vector unsigned long long a, vector unsigned long long b);
2022 For each integer value ``i`` from 0 to 1, do the following. The integer in
2023 doubleword element ``i`` of a is divided by the integer in doubleword
2024 element ``i`` of b. The unique integer remainder is placed into the
2025 doubleword element ``i`` of the vector returned. If an attempt is made to
2026 perform <anything> ÷ 0 then the remainder is undefined.
2028 Generate PCV from specified Mask size, as if implemented by the
2029 ``xxgenpcvbm``, ``xxgenpcvhm``, ``xxgenpcvwm`` instructions, where
2030 immediate value is either 0, 1, 2 or 3.
2032 .. index:: vec_genpcvm
2036 vector unsigned __int128 vec_rl (vector unsigned __int128 A, vector unsigned __int128 B);
2037 vector signed __int128 vec_rl (vector signed __int128 A, vector unsigned __int128 B);
2039 Result value: Each element of R is obtained by rotating the corresponding element
2040 of A left by the number of bits specified by the corresponding element of B.
2044 vector unsigned __int128 vec_rlmi (vector unsigned __int128, vector unsigned __int128, vector unsigned __int128);
2045 vector signed __int128 vec_rlmi (vector signed __int128, vector signed __int128, vector unsigned __int128);
2047 Returns the result of rotating the first input and inserting it under mask
2048 into the second input. The first bit in the mask, the last bit in the mask are
2049 obtained from the two 7-bit fields bits [108:115] and bits [117:123]
2050 respectively of the second input. The shift is obtained from the third input
2051 in the 7-bit field [125:131] where all bits counted from zero at the left.
2055 vector unsigned __int128 vec_rlnm (vector unsigned __int128, vector unsigned __int128, vector unsigned __int128);
2056 vector signed __int128 vec_rlnm (vector signed __int128, vector unsigned __int128, vector unsigned __int128);
2058 Returns the result of rotating the first input and ANDing it with a mask. The
2059 first bit in the mask and the last bit in the mask are obtained from the two
2060 7-bit fields bits [117:123] and bits [125:131] respectively of the second
2061 input. The shift is obtained from the third input in the 7-bit field bits
2062 [125:131] where all bits counted from zero at the left.
2066 vector unsigned __int128 vec_sl(vector unsigned __int128 A, vector unsigned __int128 B);
2067 vector signed __int128 vec_sl(vector signed __int128 A, vector unsigned __int128 B);
2069 Result value: Each element of R is obtained by shifting the corresponding element of
2070 A left by the number of bits specified by the corresponding element of B.
2074 vector unsigned __int128 vec_sr(vector unsigned __int128 A, vector unsigned __int128 B);
2075 vector signed __int128 vec_sr(vector signed __int128 A, vector unsigned __int128 B);
2077 Result value: Each element of R is obtained by shifting the corresponding element of
2078 A right by the number of bits specified by the corresponding element of B.
2082 vector unsigned __int128 vec_sra(vector unsigned __int128 A, vector unsigned __int128 B);
2083 vector signed __int128 vec_sra(vector signed __int128 A, vector unsigned __int128 B);
2085 Result value: Each element of R is obtained by arithmetic shifting the corresponding
2086 element of A right by the number of bits specified by the corresponding element of B.
2090 vector unsigned __int128 vec_mule (vector unsigned long long, vector unsigned long long);
2091 vector signed __int128 vec_mule (vector signed long long, vector signed long long);
2093 Returns a vector containing a 128-bit integer result of multiplying the even
2094 doubleword elements of the two inputs.
2098 vector unsigned __int128 vec_mulo (vector unsigned long long, vector unsigned long long);
2099 vector signed __int128 vec_mulo (vector signed long long, vector signed long long);
2101 Returns a vector containing a 128-bit integer result of multiplying the odd
2102 doubleword elements of the two inputs.
2106 vector unsigned __int128 vec_div (vector unsigned __int128, vector unsigned __int128);
2107 vector signed __int128 vec_div (vector signed __int128, vector signed __int128);
2109 Returns the result of dividing the first operand by the second operand. An
2110 attempt to divide any value by zero or to divide the most negative signed
2111 128-bit integer by negative one results in an undefined value.
2115 vector unsigned __int128 vec_dive (vector unsigned __int128, vector unsigned __int128);
2116 vector signed __int128 vec_dive (vector signed __int128, vector signed __int128);
2118 The result is produced by shifting the first input left by 128 bits and
2119 dividing by the second. If an attempt is made to divide by zero or the result
2120 is larger than 128 bits, the result is undefined.
2124 vector unsigned __int128 vec_mod (vector unsigned __int128, vector unsigned __int128);
2125 vector signed __int128 vec_mod (vector signed __int128, vector signed __int128);
2127 The result is the modulo result of dividing the first input by the second
2130 The following builtins perform 128-bit vector comparisons. The
2131 ``vec_all_xx``, ``vec_any_xx``, and ``vec_cmpxx``, where ``xx`` is
2132 one of the operations ``eq, ne, gt, lt, ge, le`` perform pairwise
2133 comparisons between the elements at the same positions within their two vector
2134 arguments. The ``vec_all_xx`` function returns a non-zero value if and only
2135 if all pairwise comparisons are true. The ``vec_any_xx`` function returns
2136 a non-zero value if and only if at least one pairwise comparison is true. The
2137 ``vec_cmpxx`` function returns a vector of the same type as its two
2138 arguments, within which each element consists of all ones to denote that
2139 specified logical comparison of the corresponding elements was true.
2140 Otherwise, the element of the returned vector contains all zeros.
2144 vector bool __int128 vec_cmpeq (vector signed __int128, vector signed __int128);
2145 vector bool __int128 vec_cmpeq (vector unsigned __int128, vector unsigned __int128);
2146 vector bool __int128 vec_cmpne (vector signed __int128, vector signed __int128);
2147 vector bool __int128 vec_cmpne (vector unsigned __int128, vector unsigned __int128);
2148 vector bool __int128 vec_cmpgt (vector signed __int128, vector signed __int128);
2149 vector bool __int128 vec_cmpgt (vector unsigned __int128, vector unsigned __int128);
2150 vector bool __int128 vec_cmplt (vector signed __int128, vector signed __int128);
2151 vector bool __int128 vec_cmplt (vector unsigned __int128, vector unsigned __int128);
2152 vector bool __int128 vec_cmpge (vector signed __int128, vector signed __int128);
2153 vector bool __int128 vec_cmpge (vector unsigned __int128, vector unsigned __int128);
2154 vector bool __int128 vec_cmple (vector signed __int128, vector signed __int128);
2155 vector bool __int128 vec_cmple (vector unsigned __int128, vector unsigned __int128);
2157 int vec_all_eq (vector signed __int128, vector signed __int128);
2158 int vec_all_eq (vector unsigned __int128, vector unsigned __int128);
2159 int vec_all_ne (vector signed __int128, vector signed __int128);
2160 int vec_all_ne (vector unsigned __int128, vector unsigned __int128);
2161 int vec_all_gt (vector signed __int128, vector signed __int128);
2162 int vec_all_gt (vector unsigned __int128, vector unsigned __int128);
2163 int vec_all_lt (vector signed __int128, vector signed __int128);
2164 int vec_all_lt (vector unsigned __int128, vector unsigned __int128);
2165 int vec_all_ge (vector signed __int128, vector signed __int128);
2166 int vec_all_ge (vector unsigned __int128, vector unsigned __int128);
2167 int vec_all_le (vector signed __int128, vector signed __int128);
2168 int vec_all_le (vector unsigned __int128, vector unsigned __int128);
2170 int vec_any_eq (vector signed __int128, vector signed __int128);
2171 int vec_any_eq (vector unsigned __int128, vector unsigned __int128);
2172 int vec_any_ne (vector signed __int128, vector signed __int128);
2173 int vec_any_ne (vector unsigned __int128, vector unsigned __int128);
2174 int vec_any_gt (vector signed __int128, vector signed __int128);
2175 int vec_any_gt (vector unsigned __int128, vector unsigned __int128);
2176 int vec_any_lt (vector signed __int128, vector signed __int128);
2177 int vec_any_lt (vector unsigned __int128, vector unsigned __int128);
2178 int vec_any_ge (vector signed __int128, vector signed __int128);
2179 int vec_any_ge (vector unsigned __int128, vector unsigned __int128);
2180 int vec_any_le (vector signed __int128, vector signed __int128);
2181 int vec_any_le (vector unsigned __int128, vector unsigned __int128);