Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c

raw
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-require-effective-target vect_char_add } */
5 /* { dg-add-options double_vectors } */
6
7 #include <stdarg.h>
8 #include "tree-vect.h"
9
10 #if VECTOR_BITS > 128
11 #define N (VECTOR_BITS * 2 / 8)
12 #else
13 #define N 32
14 #endif
15
16 unsigned int ic[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
17 {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};
18 unsigned int ib[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
19 {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 unsigned short sc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
21 {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};
22 unsigned short sb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
23 {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};
24 unsigned char cc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
25 {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 unsigned char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
27 {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};
28
29 __attribute__ ((noinline))
30 int main1 (int n,
31 unsigned int * __restrict__ pic, unsigned int * __restrict__ pib,
32 unsigned short * __restrict__ psc, unsigned short * __restrict__ psb,
33 unsigned char * __restrict__ pcc, unsigned char * __restrict__ pcb)
34 {
35 int i;
36 unsigned int ia[N];
37 unsigned short sa[N];
38 unsigned char ca[N];
39
40 /* Multiple types with different sizes, used in independent
41 computations. Vectorizable. The loads are misaligned. */
42 for (i = 0; i < n; i++)
43 {
44 ia[i] = pib[i] + pic[i];
45 sa[i] = psb[i] + psc[i];
46 ca[i] = pcb[i] + pcc[i];
47 }
48
49 /* check results: */
50 #pragma GCC novector
51 for (i = 0; i < n; i++)
52 {
53 if (ia[i] != pib[i] + pic[i]
54 || sa[i] != psb[i] + psc[i]
55 || ca[i] != pcb[i] + pcc[i])
56 abort ();
57 }
58
59 return 0;
60 }
61
62 int main (void)
63 {
64 check_vect ();
65
66 main1 (N, ic, ib, sc, sb, cc, cb);
67 main1 (N-3, ic, ib, &sc[1], sb, cc, &cb[2]);
68 return 0;
69 }
70
71 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
72 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 6 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
73 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 6 "vect" { xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */
74