summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
blob: 0d4d54fe0c2ad3360af4498248fc9fbb35f55543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* { dg-require-effective-target vect_condition } */

#include "tree-vect.h"

#define N 128

__attribute__((noinline, noclone)) void
foo (short * __restrict__ a, int * __restrict__ b, int stride)
{
  int i;

  for (i = 0; i < N/stride; i++, a += stride, b += stride)
   {
     a[0] = b[0] ? 1 : 7;
     a[1] = b[1] ? 2 : 0;
     a[2] = b[2] ? 3 : 0;
     a[3] = b[3] ? 4 : 0;
     a[4] = b[4] ? 5 : 0;
     a[5] = b[5] ? 6 : 0;
     a[6] = b[6] ? 7 : 0;
     a[7] = b[7] ? 8 : 0;
   }
}

short a[N];
int b[N];
int main ()
{
  int i;

  check_vect ();

  for (i = 0; i < N; i++)
    {
      a[i] = i;
      b[i] = -i;
    }

  foo (a, b, 8);

  for (i = 1; i < N; i++)
    if (a[i] != i%8 + 1)
      abort ();

  if (a[0] != 7)
    abort ();

  return 0;
}

/* { dg-final { scan-tree-dump-times "Vectorized basic-block" 1 "slp" { target { vect_element_align && vect_pack_trunc } } } } */
/* { dg-final { cleanup-tree-dump "slp" } } */