1 /* { dg-do run } */
2 #define vector(elcount, type) \
3 __attribute__((vector_size((elcount)*sizeof(type)))) type
4
5 #define vidx(type, vec, idx) (*((type *) &(vec) + idx))
6 #define uint unsigned int
7
main(int argc,char * argv[])8 int main (int argc, char *argv[]) {
9 vector(4, uint) vuint = { 1, 2, 3, 4};
10 vector(4, int) vint0 = { 1, 1, 1, 1};
11 vector(4, int) vint1 = {-1, -1, -1, -1};
12
13 vector(4, int) i1, i2, i3;
14 vector(4, uint) u1, u2, u3;
15
16 i1 = vint1<< vint0;
17
18 if (vidx(int, i1, 0) != ((int)-1 << (int)1))
19 __builtin_abort ();
20 if (vidx(int, i1, 1) != ((int)-1 << (int)1))
21 __builtin_abort ();
22 if (vidx(int, i1, 2) != ((int)-1 << (int)1))
23 __builtin_abort ();
24 if (vidx(int, i1, 3) != ((int)-1 << (int)1))
25 __builtin_abort ();
26
27 u1 = vuint << vint0;
28
29 if (vidx(int, u1, 0) != ((uint)1 << (int)1))
30 __builtin_abort ();
31 if (vidx(int, u1, 1) != ((uint)2 << (int)1))
32 __builtin_abort ();
33 if (vidx(int, u1, 2) != ((uint)3 << (int)1))
34 __builtin_abort ();
35 if (vidx(int, u1, 3) != ((uint)4 << (int)1))
36 __builtin_abort ();
37
38
39 i2 = vint1 >> vuint;
40
41 if (vidx(int, i2, 0) != ((int)-1 >> (uint)1))
42 __builtin_abort ();
43 if (vidx(int, i2, 1) != ((int)-1 >> (uint)2))
44 __builtin_abort ();
45 if (vidx(int, i2, 2) != ((int)-1 >> (uint)3))
46 __builtin_abort ();
47 if (vidx(int, i2, 3) != ((int)-1 >> (uint)4))
48 __builtin_abort ();
49
50
51 vint1 >>= vuint;
52
53 vuint <<= vint0;
54 vuint <<= vint1;
55
56
57 return 0;
58 }
59
60
61