Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-109.c

raw
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 #pragma GCC novector
38 for (i = 0; i < n; i++)
39 {
40 if (sa[i+2] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
41 abort ();
42 }
43
44 return 0;
45 }
46
47 int main2 (int n)
48 {
49 int i;
50
51 /* Multiple types with different sizes, used in idependent
52 copmutations. Vectorizable. */
53 for (i = 0; i < n; i++)
54 {
55 ia[i+1] = ib[i] + ic[i];
56 sa[i] = sb[i] + sc[i];
57 }
58
59 /* check results: */
60 #pragma GCC novector
61 for (i = 0; i < n; i++)
62 {
63 if (sa[i] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
64 abort ();
65 }
66
67 return 0;
68 }
69
70
71 int main (void)
72 {
73 check_vect ();
74
75 main1 (N-2);
76 main2 (N-1);
77
78 return 0;
79 }
80
81 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_element_align } } } */
82 /* { dg-final { scan-tree-dump-times "unsupported unaligned access" 2 "vect" { xfail vect_element_align } } } */
83 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! vect_unaligned_possible } } } } */
84
85 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */