(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
vec-strir-20.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 "-O1 -mdejagnu-cpu=power10" } */
       5  /* See vec-strir-21.c for the same test with -O2 optimization.  */
       6  
       7  #include <altivec.h>
       8  
       9  extern void abort (void);
      10  
      11  vector unsigned short
      12  doString(vector unsigned short *vp)
      13  {
      14    /* Though two built-in functions are called, the implementation
      15       should use a single instruction to implement both with -O1.  */
      16    vector unsigned short result = vec_strir (*vp);
      17    if (vec_strir_p (*vp))
      18      return result;
      19    else
      20      return doString (vp + 1);
      21  }
      22  
      23  int main (int argc, short *argv [])
      24  {
      25    vector unsigned short composed_string [4] = {
      26      { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
      27      { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
      28      { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 },
      29      { 0x1, 0x3, 0x5, 0x7, 0x9, 0x0, 0xd, 0xe }
      30    };
      31  
      32    vector unsigned short expected0 =
      33      { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
      34    vector unsigned short expected1 =
      35      { 0x0, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
      36    vector unsigned short expected2 =
      37      { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
      38    vector unsigned short expected3 =
      39      { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0xe };
      40  
      41    if (!vec_all_eq (doString (&composed_string[0]), expected1))
      42      abort ();
      43    if (!vec_all_eq (doString (&composed_string[1]), expected1))
      44      abort ();
      45    if (!vec_all_eq (doString (&composed_string[2]), expected2))
      46      abort ();
      47    if (!vec_all_eq (doString (&composed_string[3]), expected3))
      48      abort ();
      49  }