Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-3.c
blob22711aa0ab143ff949eed2da5a7d747af5221bcb
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 32
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};
15 __attribute__ ((noinline))
16 int main1 (int n, int * __restrict__ pib,
17 short * __restrict__ psb,
18 char * __restrict__ pcb)
20 int i;
21 int ia[N];
22 short sa[N];
23 char ca[N];
25 /* Multiple types with different sizes, used in independent
26 computations. Vectorizable. The loads are misaligned. */
27 for (i = 0; i < n; i++)
29 ia[i] = pib[i];
30 sa[i] = psb[i];
31 ca[i] = pcb[i];
34 /* check results: */
35 for (i = 0; i < n; i++)
37 if (ia[i] != pib[i]
38 || sa[i] != psb[i]
39 || ca[i] != pcb[i])
40 abort ();
43 return 0;
46 int main (void)
48 check_vect ();
50 main1 (N, ib, sb, cb);
51 main1 (N-3, ib, sb, &cb[2]);
52 return 0;
55 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
56 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } } */
57 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" {xfail vect_no_align } } } */
58 /* { dg-final { cleanup-tree-dump "vect" } } */