(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
pextd-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-require-effective-target lp64 } */
       5  /* { dg-options "-mdejagnu-cpu=power10" } */
       6  
       7  extern void abort (void);
       8  
       9  unsigned long long int
      10  do_pextd (unsigned long long int source, unsigned long long int mask) {
      11    return __builtin_pextd (source, mask);
      12  }
      13  
      14  int main (int argc, char *argv [])
      15  {
      16    unsigned long long int sources [4], masks [4];
      17    unsigned long long int results [4][4] = {
      18      /* sources [0] with each of masks [0..3] */
      19      { 0x0000a5f0ll, 0x00007e3cll, 0x000050ecll, 0x0000af73ll },
      20      /* sources [1] with each of masks [0..3] */
      21      { 0x00007e3cll, 0x0000a5f0ll, 0x0000ec50ll, 0x000073afll },
      22      /* sources [2] with each of masks [0..3] */
      23      { 0x00003ca5ll, 0x0000f07ell, 0x0000c50ell, 0x00003af7ll },
      24      /* sources [3] with each of masks [0..3] */
      25      { 0x00005a0fll, 0x0000e7c3ll, 0x0000af73ll, 0x000050ecll },
      26    };
      27  
      28    sources[0] = 0xa5f07e3cll;
      29    sources[1] = 0x7e3ca5f0ll;
      30    sources[2] = 0x3ca5f07ell;
      31    sources[3] = 0x5a0fe7c3ll;
      32  
      33    masks[0] = 0xffff0000ll;
      34    masks[1] = 0x0000ffffll;
      35    masks[2] = 0x0f0f0f0fll;
      36    masks[3] = 0xf0f0f0f0ll;
      37  
      38    unsigned long long int result;
      39  
      40    for (int i = 0; i < 4; i++)
      41      {
      42        for (int j = 0; j < 4; j++)
      43  	{
      44  	  if (do_pextd (sources[i], masks[j]) != results [i][j])
      45  	    abort ();
      46  	}
      47      }
      48  
      49    return 0;
      50  }