1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-require-effective-target vect_shift } */
4
5 #define N 32
6
7 /* All the loops are vectorizable on platforms with vector shift argument. */
8
9 void
test_1(void)10 test_1 (void)
11 {
12 static unsigned int bm[N];
13 static unsigned int cm[N];
14 int j;
15
16 /* Vectorizable on platforms with scalar shift argument. */
17 for (j = 0; j < N/2; j++)
18 {
19 bm[2*j] <<= 8;
20 bm[2*j+1] <<= 8;
21 }
22
23 /* Not vectorizable on platforms with scalar shift argument. */
24 for (j = 0; j < N/2; j++)
25 {
26 cm[2*j] <<= 8;
27 cm[2*j+1] <<= 7;
28 }
29 }
30
31 void
test_2(int a,int b)32 test_2 (int a, int b)
33 {
34 static unsigned int bm[N];
35 static unsigned int cm[N];
36 int j;
37
38 /* Vectorizable on platforms with scalar shift argument. */
39 for (j = 0; j < N/2; j++)
40 {
41 bm[2*j] <<= a;
42 bm[2*j+1] <<= a;
43 }
44
45 /* Not vectorizable on platforms with scalar shift argument. */
46 for (j = 0; j < N/2; j++)
47 {
48 cm[2*j] <<= a;
49 cm[2*j+1] <<= b;
50 }
51 }
52
53 void
test_3(void)54 test_3 (void)
55 {
56 static unsigned int bm[N];
57 int am[N];
58 int j;
59
60 /* Not vectorizable on platforms with scalar shift argument. */
61 for (j = 0; j < N/2; j++)
62 {
63 bm[2*j] <<= am[j];
64 bm[2*j+1] <<= am[j];
65 }
66
67 /* Not vectorizable on platforms with scalar shift argument. */
68 for (j = 0; j < N/2; j++)
69 {
70 bm[2*j] <<= am[2*j];
71 bm[2*j+1] <<= am[2*j+1];
72 }
73
74 }
75
76