PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-6.c
blobb47a93ab326be666ba2037c2dead5703c5f2a229
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 unsigned int ic[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 unsigned int ib[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 unsigned short sc[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};
19 unsigned short sb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
20 {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};
21 unsigned char cc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
22 {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};
23 unsigned char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
24 {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};
26 __attribute__ ((noinline))
27 int main1 (int n,
28 unsigned int * __restrict__ pic, unsigned int * __restrict__ pib,
29 unsigned short * __restrict__ psc, unsigned short * __restrict__ psb,
30 unsigned char * __restrict__ pcc, unsigned char * __restrict__ pcb)
32 int i;
33 unsigned int ia[N];
34 unsigned short sa[N];
35 unsigned char ca[N];
37 /* Multiple types with different sizes, used in independent
38 computations. Vectorizable. The loads are misaligned. */
39 for (i = 0; i < n; i++)
41 ia[i] = pib[i] + pic[i];
42 sa[i] = psb[i] + psc[i];
43 ca[i] = pcb[i] + pcc[i];
46 /* check results: */
47 for (i = 0; i < n; i++)
49 if (ia[i] != pib[i] + pic[i]
50 || sa[i] != psb[i] + psc[i]
51 || ca[i] != pcb[i] + pcc[i])
52 abort ();
55 return 0;
58 int main (void)
60 check_vect ();
62 main1 (N, ic, ib, sc, sb, cc, cb);
63 main1 (N-3, ic, ib, &sc[1], sb, cc, &cb[2]);
64 return 0;
67 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { sparc*-*-* && ilp32 } }} } */
68 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 6 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
69 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 6 "vect" { xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */