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