Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-align-1.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
3
4 #include <stdlib.h>
5 #include <stdarg.h>
6 #include "tree-vect.h"
7
8 /* Compile time known misalignment. Cannot use loop peeling to align
9 the store. */
10
11 #define N 16
12
13 struct foo {
14 char x;
15 int y[N];
16 } __attribute__((packed));
17
18 int x[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
19
20 __attribute__ ((noinline)) int
21 main1 (struct foo * __restrict__ p)
22 {
23 int i;
24
25 for (i = 0; i < N; i++)
26 {
27 p->y[i] = x[i];
28 }
29
30 /* check results: */
31 #pragma GCC novector
32 for (i = 0; i < N; i++)
33 {
34 if (p->y[i] != x[i])
35 abort ();
36 }
37 return 0;
38 }
39
40
41 int main (void)
42 {
43 int i;
44 struct foo *p = malloc (2*sizeof (struct foo));
45 check_vect ();
46
47 main1 (p);
48 return 0;
49 }
50
51 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_hw_misalign && { arm_vect_no_misalign } } } } } */
52 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_hw_misalign && arm_vect_no_misalign } } } } */
53 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */