2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-3.c
blob18bf5e80917ab38a56dfc7fbc0875b9b72683c62
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options double_vectors } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #if VECTOR_BITS > 128
8 #define N (VECTOR_BITS * 2 / 8)
9 #else
10 #define N 32
11 #endif
13 int ib[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
14 {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 short sb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
16 {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};
17 char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
18 {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};
20 __attribute__ ((noinline))
21 int main1 (int n, int * __restrict__ pib,
22 short * __restrict__ psb,
23 char * __restrict__ pcb)
25 int i;
26 int ia[N];
27 short sa[N];
28 char ca[N];
30 /* Multiple types with different sizes, used in independent
31 computations. Vectorizable. The loads are misaligned. */
32 for (i = 0; i < n; i++)
34 ia[i] = pib[i];
35 sa[i] = psb[i];
36 ca[i] = pcb[i];
39 /* check results: */
40 for (i = 0; i < n; i++)
42 if (ia[i] != pib[i]
43 || sa[i] != psb[i]
44 || ca[i] != pcb[i])
45 abort ();
48 return 0;
51 int main (void)
53 check_vect ();
55 main1 (N, ib, sb, cb);
56 main1 (N-3, ib, sb, &cb[2]);
57 return 0;
60 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
61 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
62 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */