rsha Jagasia <harsha.jagasia@amd.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / costmodel / i386 / costmodel-vect-31.c
blobefab30d4ac6c5a08c7d9766f996b100c5518d444
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "../../tree-vect.h"
6 #define N 32
8 struct t{
9 int k[N];
10 int l;
13 struct s{
14 char a; /* aligned */
15 char b[N-1]; /* unaligned (offset 1B) */
16 char c[N]; /* aligned (offset NB) */
17 struct t d; /* aligned (offset 2NB) */
18 struct t e; /* unaligned (offset 2N+4N+4 B) */
21 int main1 ()
23 int i;
24 struct s tmp;
26 /* unaligned */
27 for (i = 0; i < N/2; i++)
29 tmp.b[i] = 5;
32 /* check results: */
33 for (i = 0; i <N/2; i++)
35 if (tmp.b[i] != 5)
36 abort ();
39 /* aligned */
40 for (i = 0; i < N/2; i++)
42 tmp.c[i] = 6;
45 /* check results: */
46 for (i = 0; i <N/2; i++)
48 if (tmp.c[i] != 6)
49 abort ();
52 /* aligned */
53 for (i = 0; i < N/2; i++)
55 tmp.d.k[i] = 7;
58 /* check results: */
59 for (i = 0; i <N/2; i++)
61 if (tmp.d.k[i] != 7)
62 abort ();
65 /* unaligned */
66 for (i = 0; i < N/2; i++)
68 tmp.e.k[i] = 8;
71 /* check results: */
72 for (i = 0; i <N/2; i++)
74 if (tmp.e.k[i] != 8)
75 abort ();
78 return 0;
81 int main (void)
83 check_vect ();
85 return main1 ();
88 /* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } }
90 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
91 /* { dg-final { cleanup-tree-dump "vect" } } */