1 /* { dg-require-effective-target vect_int } */ 2 3 #include <stdarg.h> 4 #include "tree-vect.h" 5 6 #define N 128 7 8 char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); 9 char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); 10 11 __attribute__ ((noinline)) main1()12int main1 () 13 { 14 struct { 15 char *p; 16 char *q; 17 } s; 18 int i; 19 for (i = 0; i < N; i++) 20 { 21 cb[i] = i*3; 22 asm volatile ("" ::: "memory"); 23 } 24 25 /* Check that datarefs analysis can determine that the access via pointer 26 s.p is based off array x, which enables us to antialias this access from 27 the access to array cb. */ 28 s.p = x; 29 for (i = 0; i < N; i++) 30 { 31 s.p[i] = cb[i]; 32 } 33 34 /* check results: */ 35 for (i = 0; i < N; i++) 36 { 37 if (s.p[i] != cb[i]) 38 abort (); 39 } 40 41 /* Check that datarefs analysis can determine that the access via pointer 42 s.p is based off array x, and that the access via pointer s.q is based off 43 array cb, which enables us to antialias these two accesses. */ 44 s.q = cb; 45 for (i = 0; i < N; i++) 46 { 47 s.p[i] = s.q[i]; 48 } 49 50 /* check results: */ 51 for (i = 0; i < N; i++) 52 { 53 if (s.p[i] != s.q[i]) 54 abort (); 55 } 56 57 return 0; 58 } 59 main(void)60int main (void) 61 { 62 check_vect (); 63 64 return main1 (); 65 } 66 67 68 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ 69 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ 70