2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-section-anchors-vect-69.c
blob5f0aeaa9df19d237aa38270e84c279970e2b6b7f
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 12
8 struct s{
9 int m;
10 int n[N][N][N];
13 struct s2{
14 int m;
15 int n[N-1][N-1][N-1];
18 struct test1{
19 struct s a; /* array a.n is unaligned */
20 int b;
21 int c;
22 struct s e; /* array e.n is aligned */
25 struct test2{
26 struct s2 a; /* array a.n is unaligned */
27 int b;
28 int c;
29 struct s2 e; /* array e.n is aligned */
33 struct test1 tmp1[4];
34 struct test2 tmp2[4];
36 __attribute__ ((noinline))
37 int main1 ()
39 int i,j;
41 /* 1. unaligned (known misalignment) */
42 for (i = 0; i < N; i++)
44 tmp1[2].a.n[1][2][i] = 5;
47 /* check results: */
48 for (i = 0; i <N; i++)
50 if (tmp1[2].a.n[1][2][i] != 5)
51 abort ();
54 /* 2. aligned */
55 for (i = 3; i < N-1; i++)
57 tmp1[2].a.n[1][2][i] = 6;
60 /* check results: */
61 for (i = 3; i < N-1; i++)
63 if (tmp1[2].a.n[1][2][i] != 6)
64 abort ();
67 /* 3. aligned */
68 for (i = 0; i < N; i++)
70 for (j = 0; j < N; j++)
72 tmp1[2].e.n[1][i][j] = 8;
76 /* check results: */
77 for (i = 0; i < N; i++)
79 for (j = 0; j < N; j++)
81 if (tmp1[2].e.n[1][i][j] != 8)
82 abort ();
86 /* 4. unaligned (unknown misalignment) */
87 for (i = 0; i < N-4; i++)
89 for (j = 0; j < N-4; j++)
91 tmp2[2].e.n[1][i][j] = 8;
95 /* check results: */
96 for (i = 0; i < N-4; i++)
98 for (j = 0; j < N-4; j++)
100 if (tmp2[2].e.n[1][i][j] != 8)
101 abort ();
105 return 0;
108 int main (void)
110 check_vect ();
112 return main1 ();
115 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
116 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail vect_hw_misalign } } } */
117 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target vect_hw_misalign } } } */
118 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { {! vector_alignment_reachable} || vect_hw_misalign } } } } */
119 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
120 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
121 /* { dg-final { cleanup-tree-dump "vect" } } */