1 /* Verify strlen results of vector assignments.
3 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
7 #define V(N) __attribute__ ((vector_size (N)))
9 typedef V (1) char VC1
;
10 typedef V (2) char VC2
;
11 typedef V (4) char VC4
;
12 typedef V (8) char VC8
;
13 typedef V (16) char VC16
;
17 #define A(expr) ((expr) ? (void)0 : abort ())
19 void test_fold (int i
)
23 A (!a
[1] && !a
[2] && !a
[3]);
25 *(VC4
*)a
= (VC4
){ 0, 1 };
27 A (a
[1] == 1 && !a
[2] && !a
[3]);
29 *(VC4
*)a
= (VC4
){ 1 };
31 A (!a
[1] && !a
[2] && !a
[3]);
33 *(VC4
*)a
= (VC4
){ 1, 0, 3 };
35 A (!a
[1] && a
[2] == 3 && !a
[3]);
37 *(VC4
*)a
= (VC4
){ 1, 2 };
41 *(VC4
*)a
= (VC4
){ 1, 2, 0, 4 };
43 A (!a
[2] && a
[3] == 4);
45 *(VC4
*)a
= (VC4
){ 1, 2, 3 };
49 *(VC8
*)a
= (VC8
){ 1, 2, 3, 0, 5 };
52 *(VC8
*)a
= (VC8
){ 1, 2, 3, 0, 5, 6 };
55 *(VC8
*)a
= (VC8
){ 1, 2, 3, 0, 5, 6, 7, 8 };
57 A (strlen (a
+ 1) == 2);
58 A (strlen (a
+ 2) == 1);
59 A (strlen (a
+ 3) == 0);
61 A (a
[4] == 5 && a
[5] == 6 && a
[6] == 7 && a
[7] == 8);
64 /* { dg-final { scan-tree-dump-not "abort \\(" "optimized" } }
65 { dg-final { scan-tree-dump-not "strlen \\(" "optimized" } } */