]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/vect/vect-66.c
Fix profile update after prologue peeling in vectorizer
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / vect / vect-66.c
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 16
8
9 __attribute__ ((noinline))
10 void main1 ()
11 {
12 int i, j;
13 int ia[8][5][N+2];
14
15 /* Multidimensional array. Aligned. */
16 for (i = 0; i < 16; i++)
17 {
18 for (j = 0; j < N; j++)
19 {
20 ia[2][6][j] = 5;
21 }
22 }
23
24 /* check results: */
25 for (i = 0; i < 16; i++)
26 {
27 for (j = 0; j < N; j++)
28 {
29 if (ia[2][6][j] != 5)
30 abort();
31 }
32 }
33 }
34
35 __attribute__ ((noinline))
36 void main2 ()
37 {
38 int i, j;
39 int ia[8][5][N+2];
40
41 /* Multidimensional array. Aligned. */
42 for (i = 0; i < 16; i++)
43 {
44 for (j = 0; j < N; j++)
45 ia[3][6][j+2] = 5;
46 }
47
48 /* check results: */
49 for (i = 0; i < 16; i++)
50 {
51 for (j = 2; j < N+2; j++)
52 {
53 if (ia[3][6][j] != 5)
54 abort();
55 }
56 }
57 }
58
59 __attribute__ ((noinline))
60 void main3 ()
61 {
62 int i, j;
63 int ic[16][16][5][N+2];
64
65 /* Multidimensional array. Not aligned. */
66 for (i = 0; i < 16; i++)
67 {
68 for (j = 0; j < N; j++)
69 {
70 ic[2][1][6][j+1] = 5;
71 }
72 }
73
74 /* check results: */
75 for (i = 0; i < 16; i++)
76 {
77 for (j = 0; j < N; j++)
78 {
79 if (ic[2][1][6][j+1] != 5)
80 abort();
81 }
82 }
83 }
84
85 int main (void)
86 {
87 check_vect ();
88
89 main1 ();
90 main2 ();
91 main3 ();
92
93 return 0;
94 }
95
96 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */
97 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */