1 /* PR tree-optimization/80631 */
2
3 #include "tree-vect.h"
4
5 int v[8] = { 77, 1, 79, 3, 4, 3, 6, 7 };
6
7 __attribute__((noipa)) void
f1(void)8 f1 (void)
9 {
10 int k, r = -1;
11 for (k = 7; k >= 0; k--)
12 if (v[k] == 77)
13 r = k;
14 if (r != 0)
15 abort ();
16 }
17
18 __attribute__((noipa)) void
f2(void)19 f2 (void)
20 {
21 int k, r = 4;
22 for (k = 7; k >= 0; k--)
23 if (v[k] == 79)
24 r = k;
25 if (r != 2)
26 abort ();
27 }
28
29 __attribute__((noipa)) void
f3(void)30 f3 (void)
31 {
32 int k, r = -17;
33 for (k = 7; k >= 0; k--)
34 if (v[k] == 78)
35 r = k;
36 if (r != -17)
37 abort ();
38 }
39
40 __attribute__((noipa)) void
f4(void)41 f4 (void)
42 {
43 int k, r = 7;
44 for (k = 7; k >= 0; k--)
45 if (v[k] == 78)
46 r = k;
47 if (r != 7)
48 abort ();
49 }
50
51 __attribute__((noipa)) void
f5(void)52 f5 (void)
53 {
54 int k, r = -1;
55 for (k = 7; k >= 0; k--)
56 if (v[k] == 3)
57 r = k;
58 if (r != 3)
59 abort ();
60 }
61
62 int
main()63 main ()
64 {
65 check_vect ();
66 f1 ();
67 f2 ();
68 f3 ();
69 f4 ();
70 f5 ();
71 return 0;
72 }
73
74 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { target vect_condition } } } */
75 /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 10 "vect" { target vect_condition } } } */
76