summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/slp-36.c
blob: 8480c4a05f1b3e6d2f3765c421035ea4c4cd5327 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_shift } */

#define N 32

/* All the loops are vectorizable on platforms with vector shift argument.  */

void
test_1 (void)
{
  static unsigned int bm[N];
  static unsigned int cm[N];
  int j;

  /* Vectorizable on platforms with scalar shift argument.  */
  for (j = 0; j < N/2; j++)
   {
    bm[2*j] <<= 8;
    bm[2*j+1] <<= 8;
   }

  /* Not vectorizable on platforms with scalar shift argument.  */
  for (j = 0; j < N/2; j++)
   {
    cm[2*j] <<= 8;
    cm[2*j+1] <<= 7;
   }
}

void
test_2 (int a, int b)
{
  static unsigned int bm[N];
  static unsigned int cm[N];
  int j;

  /* Vectorizable on platforms with scalar shift argument.  */
  for (j = 0; j < N/2; j++)
   {
    bm[2*j] <<= a;
    bm[2*j+1] <<= a;
   }

  /* Not vectorizable on platforms with scalar shift argument.  */
  for (j = 0; j < N/2; j++)
   {
    cm[2*j] <<= a;
    cm[2*j+1] <<= b;
   }
}

void
test_3 (void)
{
 static unsigned int bm[N];
 int am[N];
 int j;

 /* Not vectorizable on platforms with scalar shift argument.  */
 for (j = 0; j < N/2; j++)
   {
    bm[2*j] <<= am[j];
    bm[2*j+1] <<= am[j];
   }

 /* Not vectorizable on platforms with scalar shift argument.  */
 for (j = 0; j < N/2; j++)
   {
    bm[2*j] <<= am[2*j];
    bm[2*j+1] <<= am[2*j+1];
   }

}

/* { dg-final { cleanup-tree-dump "vect" } } */