Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-multitypes-3.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-add-options double_vectors } */
5
6 #include <stdarg.h>
7 #include "tree-vect.h"
8
9 #if VECTOR_BITS > 128
10 #define N (VECTOR_BITS * 2 / 8)
11 #else
12 #define N 32
13 #endif
14
15 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 short sb[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 char cb[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
22 __attribute__ ((noinline))
23 int main1 (int n, int * __restrict__ pib,
24 short * __restrict__ psb,
25 char * __restrict__ pcb)
26 {
27 int i;
28 int ia[N];
29 short sa[N];
30 char ca[N];
31
32 /* Multiple types with different sizes, used in independent
33 computations. Vectorizable. The loads are misaligned. */
34 for (i = 0; i < n; i++)
35 {
36 ia[i] = pib[i];
37 sa[i] = psb[i];
38 ca[i] = pcb[i];
39 }
40
41 /* check results: */
42 #pragma GCC novector
43 for (i = 0; i < n; i++)
44 {
45 if (ia[i] != pib[i]
46 || sa[i] != psb[i]
47 || ca[i] != pcb[i])
48 abort ();
49 }
50
51 return 0;
52 }
53
54 int main (void)
55 {
56 check_vect ();
57
58 main1 (N, ib, sb, cb);
59 main1 (N-3, ib, sb, &cb[2]);
60 return 0;
61 }
62
63 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
64 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
65 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */
66