OSDN Git Service

* doc/tm.texi (TARGET_VECTORIZE_BUILTIN_CONVERSION): New target hook.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-109.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 32
7
8 short sa[N];
9 short sc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
10                 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
11 short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
12                 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
13 int ia[N];
14 int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
15                0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
16 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
17                0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
18
19 int main1 (int n)
20 {
21   int i;
22
23   /* Multiple types with different sizes, used in idependent
24      copmutations. Vectorizable.  */
25   for (i = 0; i < n; i++)
26     {
27       sa[i+2] = sb[i] + sc[i];
28       ia[i+1] = ib[i] + ic[i];
29     }
30
31   /* check results:  */
32   for (i = 0; i < n; i++)
33     {
34       if (sa[i+2] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
35         abort ();
36     }
37
38   return 0;
39 }
40
41 int main2 (int n)
42 {
43   int i;
44
45   /* Multiple types with different sizes, used in idependent
46      copmutations. Vectorizable.  */
47   for (i = 0; i < n; i++)
48     {
49       ia[i+1] = ib[i] + ic[i];
50       sa[i] = sb[i] + sc[i];
51     }
52
53   /* check results:  */
54   for (i = 0; i < n; i++)
55     {
56       if (sa[i] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
57         abort ();
58     }
59
60   return 0;
61 }
62
63
64 int main (void)
65
66   check_vect ();
67   
68   main1 (N-2);
69   main2 (N-1);
70
71   return 0;
72 }
73
74 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" } } */
75 /* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" } } */
76 /* { dg-final { cleanup-tree-dump "vect" } } */
77