1 /* { dg-require-effective-target vect_int } */
2
3 #include "tree-vect.h"
4
5 int a[1024];
6 unsigned char b[1024];
7
8 extern void abort (void);
9
10 __attribute__((noinline, noclone)) void
foo(int k,int m)11 foo (int k, int m)
12 {
13 int i, k2 = k;
14 for (i = 0; i < 1024; i++)
15 {
16 a[i] = k2;
17 k2 += m + 1;
18 }
19 }
20
21 __attribute__((noinline, noclone)) void
bar(int k,int m)22 bar (int k, int m)
23 {
24 int i, k2 = k;
25 for (i = 0; i < 1024; i++)
26 {
27 k2 += m + 1;
28 a[i] = k2;
29 }
30 }
31
32 __attribute__((noinline, noclone)) void
baz(int k,int m)33 baz (int k, int m)
34 {
35 int i, k2 = k;
36 for (i = 0; i < 1024; i++)
37 {
38 a[i] = k2;
39 b[i] = i;
40 k2 += m + 1;
41 }
42 }
43
44 int
main()45 main ()
46 {
47 int i;
48 check_vect ();
49 foo (5, 3);
50 for (i = 0; i < 1024; i++)
51 if (a[i] != 5 + 4 * i)
52 abort ();
53 bar (5, 3);
54 for (i = 0; i < 1024; i++)
55 if (a[i] != 9 + 4 * i)
56 abort ();
57 baz (5, 3);
58 for (i = 0; i < 1024; i++)
59 if (a[i] != 5 + 4 * i || b[i] != (unsigned char) i)
60 abort ();
61 return 0;
62 }
63
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 3 "vect" { target vect_pack_trunc } } } */
65 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 2 "vect" { target { ! vect_pack_trunc } } } } */
66