PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-section-anchors-vect-69.c
blobf7ad45b4f7abd38e324ad5898def7ffec232c1a0
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
3 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #if VECTOR_BITS > 128
9 #define NINTS (VECTOR_BITS / 32)
10 #else
11 #define NINTS 4
12 #endif
14 #define N (NINTS * 6)
16 struct s{
17 int m;
18 int n[N][N][N];
21 struct s2{
22 int m;
23 int n[N-1][N-1][N-1];
26 struct test1{
27 struct s a; /* array a.n is unaligned */
28 int pad[NINTS - 2];
29 struct s e; /* array e.n is aligned */
32 struct test2{
33 struct s2 a; /* array a.n is unaligned */
34 int b;
35 int c;
36 struct s2 e; /* array e.n is aligned */
40 struct test1 tmp1[4];
41 struct test2 tmp2[4];
43 __attribute__ ((noinline))
44 int main1 ()
46 int i,j;
48 /* 1. unaligned (known misalignment) */
49 for (i = 0; i < N; i++)
51 tmp1[2].a.n[1][2][i] = 5;
54 /* check results: */
55 for (i = 0; i <N; i++)
57 if (tmp1[2].a.n[1][2][i] != 5)
58 abort ();
61 /* 2. aligned */
62 for (i = NINTS - 1; i < N - 1; i++)
64 tmp1[2].a.n[1][2][i] = 6;
67 /* check results: */
68 for (i = NINTS; i < N - 1; i++)
70 if (tmp1[2].a.n[1][2][i] != 6)
71 abort ();
74 /* 3. aligned */
75 for (i = 0; i < N; i++)
77 for (j = 0; j < N; j++)
79 tmp1[2].e.n[1][i][j] = 8;
83 /* check results: */
84 for (i = 0; i < N; i++)
86 for (j = 0; j < N; j++)
88 if (tmp1[2].e.n[1][i][j] != 8)
89 abort ();
93 /* 4. unaligned (unknown misalignment) */
94 for (i = 0; i < N - NINTS; i++)
96 for (j = 0; j < N - NINTS; j++)
98 tmp2[2].e.n[1][i][j] = 8;
102 /* check results: */
103 for (i = 0; i < N - NINTS; i++)
105 for (j = 0; j < N - NINTS; j++)
107 if (tmp2[2].e.n[1][i][j] != 8)
108 abort ();
112 return 0;
115 int main (void)
117 check_vect ();
119 return main1 ();
122 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
123 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */