(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
vec-pext-1.c
       1  /* { dg-do run { target { power10_hw } } } */
       2  /* { dg-do link { target { ! power10_hw } } } */
       3  /* { dg-require-effective-target power10_ok } */
       4  /* { dg-options "-mdejagnu-cpu=power10" } */
       5  
       6  #include <altivec.h>
       7  
       8  extern void abort (void);
       9  
      10  vector unsigned long long int
      11  do_vec_pext (vector unsigned long long int source,
      12  	     vector unsigned long long int mask) {
      13    return vec_pext (source, mask);
      14  }
      15  
      16  int main (int argc, char *argv [])
      17  {
      18    vector unsigned long long int source_a = { 0xa5f07e3cull, 0x7e3ca5f0ull };
      19    vector unsigned long long int source_b = { 0x3ca5f07eull, 0x5a0fe7c3ull };
      20  
      21    vector unsigned long long int mask_a = { 0xffff0000ull, 0x0000ffffull };
      22    vector unsigned long long int mask_b = { 0x0f0f0f0full, 0xf0f0f0f0ull };
      23  
      24    /* See pextd-0.c for derivation of expected results.
      25  
      26       result_aa [0] is compute (source [0], mask [0];
      27       result_aa [1] is compute (source [1], mask [1].
      28  
      29       result_ab [0] is compute (source [0], mask [2];
      30       result_ab [1] is compute (source [1], mask [3].
      31  
      32       result_ba [0] is compute (source [2], mask [0];
      33       result_ba [1] is compute (source [3], mask [1].
      34  
      35       result_bb [0] is compute (source [2], mask [2];
      36       result_bb [1] is compute (source [3], mask [3].  */
      37  
      38    vector unsigned long long int result_aa = { 0x0000a5f0ull, 0x0000a5f0ull };
      39    vector unsigned long long int result_ab = { 0x000050ecull, 0x000073afull };
      40    vector unsigned long long int result_ba = { 0x00003ca5ull, 0x0000e7c3ull };
      41    vector unsigned long long int result_bb = { 0x0000c50eull, 0x000050ecull };
      42  
      43    if (!vec_all_eq (do_vec_pext (source_a, mask_a), result_aa))
      44      abort ();
      45    if (!vec_all_eq (do_vec_pext (source_a, mask_b),result_ab))
      46      abort ();
      47    if (!vec_all_eq (do_vec_pext (source_b, mask_a), result_ba))
      48      abort ();
      49    if (!vec_all_eq (do_vec_pext (source_b, mask_b), result_bb))
      50      abort ();
      51  
      52    return 0;
      53  }