OSDN Git Service

* tree-vectorizer.h (struct _stmt_vec_info): Add new field
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-3.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 int ib[N] __attribute__ ((__aligned__(16))) = 
9         {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
10 short sb[N] __attribute__ ((__aligned__(16))) = 
11         {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
12 char cb[N] __attribute__ ((__aligned__(16))) = 
13         {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
14
15 int main1 (int n, int * __restrict__ pib, 
16            short * __restrict__ psb, 
17            char * __restrict__ pcb)
18 {
19   int i;
20   int ia[N];
21   short sa[N];
22   char ca[N];
23
24   /* Multiple types with different sizes, used in independent
25      computations. Vectorizable. The loads are misaligned.  */
26   for (i = 0; i < n; i++)
27     {
28       ia[i] = pib[i];
29       sa[i] = psb[i];
30       ca[i] = pcb[i];
31     }
32
33   /* check results:  */
34   for (i = 0; i < n; i++)
35     {
36       if (ia[i] != pib[i] 
37           || sa[i] != psb[i] 
38           || ca[i] != pcb[i])
39         abort ();
40     }
41
42   return 0;
43 }
44
45 int main (void)
46
47   check_vect ();
48   
49   main1 (N, ib, sb, cb);
50   main1 (N-3, ib, sb, &cb[2]);
51   return 0;
52 }
53
54 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
55 /*  { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } } */
56 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" {xfail vect_no_align } } } */
57 /* { dg-final { cleanup-tree-dump "vect" } } */
58