]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/vect/vect-109.c
Fix profile update after prologue peeling in vectorizer
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / vect / vect-109.c
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0 -fdump-tree-optimized-details-blocks" } */
3 /* { dg-skip-if "" { vect_no_align } } */
4 /* { dg-require-effective-target vect_int } */
5 /* { dg-add-options bind_pic_locally } */
6
7 #include <stdarg.h>
8 #include "tree-vect.h"
9
10 #define N 32
11
12 short sa[N];
13 short sc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
14 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
15 short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
17 int ia[N];
18 int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
19 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
20 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
21 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
22
23 __attribute__ ((noinline))
24 int main1 (int n)
25 {
26 int i;
27
28 /* Multiple types with different sizes, used in idependent
29 copmutations. Vectorizable. */
30 for (i = 0; i < n; i++)
31 {
32 sa[i+2] = sb[i] + sc[i];
33 ia[i+1] = ib[i] + ic[i];
34 }
35
36 /* check results: */
37 for (i = 0; i < n; i++)
38 {
39 if (sa[i+2] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
40 abort ();
41 }
42
43 return 0;
44 }
45
46 int main2 (int n)
47 {
48 int i;
49
50 /* Multiple types with different sizes, used in idependent
51 copmutations. Vectorizable. */
52 for (i = 0; i < n; i++)
53 {
54 ia[i+1] = ib[i] + ic[i];
55 sa[i] = sb[i] + sc[i];
56 }
57
58 /* check results: */
59 for (i = 0; i < n; i++)
60 {
61 if (sa[i] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
62 abort ();
63 }
64
65 return 0;
66 }
67
68
69 int main (void)
70 {
71 check_vect ();
72
73 main1 (N-2);
74 main2 (N-1);
75
76 return 0;
77 }
78
79 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_element_align } } } */
80 /* { dg-final { scan-tree-dump-times "unsupported unaligned access" 2 "vect" { xfail vect_element_align } } } */
81 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! vect_unaligned_possible } } } } */
82
83 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */