summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/bb-slp-27.c
blob: e9b386f4921d2af5f4b3771d0d58ec5a8f41ba6c (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
/* { dg-require-effective-target vect_int } */

#include <stdarg.h>
#include "tree-vect.h"

#define A 3
#define N 16

short src[N], dst[N];

void foo (int a)
{
  dst[0] += a*src[0];
  dst[1] += a*src[1];
  dst[2] += a*src[2];
  dst[3] += a*src[3];
  dst[4] += a*src[4];
  dst[5] += a*src[5];
  dst[6] += a*src[6];
  dst[7] += a*src[7];
}


int main (void)
{
  int i;

  check_vect ();

  for (i = 0; i < N; i++)
    {
      dst[i] = 0;
      src[i] = i;
    }

  foo (A);

  for (i = 0; i < 8; i++)
    {
      if (dst[i] != A * i)
        abort ();
    }

  return 0;
}

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