(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
bb-slp-pattern-2.c
       1  /* { dg-require-effective-target vect_condition } */
       2  /* { dg-additional-options "-fno-tree-vectorize -ftree-slp-vectorize -ftree-loop-if-convert" } */
       3  
       4  #include "tree-vect.h"
       5  
       6  #define N 128
       7  
       8  __attribute__((noinline, noclone)) void
       9  foo (short * __restrict__ a, int * __restrict__ b, int stride)
      10  {
      11    int i;
      12  
      13    for (i = 0; i < N/stride; i++, a += stride, b += stride)
      14     {
      15       a[0] = b[0] ? 1 : 7;
      16       a[1] = b[1] ? 2 : 7;
      17       a[2] = b[2] ? 3 : 0;
      18       a[3] = b[3] ? 4 : 7;
      19       a[4] = b[4] ? 5 : 0;
      20       a[5] = b[5] ? 6 : 0;
      21       a[6] = b[6] ? 7 : 0;
      22       a[7] = b[7] ? 8 : 7;
      23     }
      24  }
      25  
      26  short a[N];
      27  int b[N];
      28  int main ()
      29  {
      30    int i;
      31  
      32    check_vect ();
      33  
      34    for (i = 0; i < N; i++)
      35      {
      36        a[i] = i;
      37        b[i] = -i;
      38      }
      39  
      40    foo (a, b, 8);
      41  
      42    for (i = 1; i < N; i++)
      43      if (a[i] != i%8 + 1)
      44        abort ();
      45  
      46    if (a[0] != 7)
      47      abort ();
      48  
      49    return 0;
      50  }
      51  
      52  /* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { vect_element_align && vect_pack_trunc } } } } */