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