Tighten condition in vect/pr85586.c (PR 85654)
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr57705.c
blobe17ae09beb68051637c3ece69ac2f29e1433008d
1 /* { dg-require-effective-target vect_int } */
3 #include "tree-vect.h"
5 int a[1024];
6 unsigned char b[1024];
8 extern void abort (void);
10 __attribute__((noinline, noclone)) void
11 foo (int k, int m)
13 int i, k2 = k;
14 for (i = 0; i < 1024; i++)
16 a[i] = k2;
17 k2 += m + 1;
21 __attribute__((noinline, noclone)) void
22 bar (int k, int m)
24 int i, k2 = k;
25 for (i = 0; i < 1024; i++)
27 k2 += m + 1;
28 a[i] = k2;
32 __attribute__((noinline, noclone)) void
33 baz (int k, int m)
35 int i, k2 = k;
36 for (i = 0; i < 1024; i++)
38 a[i] = k2;
39 b[i] = i;
40 k2 += m + 1;
44 int
45 main ()
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;
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 } } } } */