1 /* { dg-require-effective-target vect_int } */ 2 3 #include <stdarg.h> 4 #include "tree-vect.h" 5 6 #define N 64 7 8 typedef struct { 9 unsigned char a; 10 unsigned char b; 11 } s; 12 13 __attribute__ ((noinline)) int main1(s * arr)14main1 (s *arr) 15 { 16 s *ptr = arr; 17 s res[N]; 18 int i; 19 20 for (i = 0; i < N; i++) 21 { 22 res[i].a = ptr->b; 23 res[i].b = ptr->b; 24 ptr++; 25 } 26 27 /* check results: */ 28 for (i = 0; i < N; i++) 29 { 30 if (res[i].a != arr[i].b 31 || res[i].b != arr[i].b) 32 abort (); 33 } 34 35 ptr = arr; 36 /* gap in store, use strided stores. */ 37 for (i = 0; i < N; i++) 38 { 39 res[i].a = ptr->b; 40 ptr++; 41 } 42 43 /* check results: */ 44 for (i = 0; i < N; i++) 45 { 46 if (res[i].a != arr[i].b) 47 abort (); 48 } 49 50 51 return 0; 52 } 53 main(void)54int main (void) 55 { 56 int i; 57 s arr[N]; 58 59 check_vect (); 60 61 for (i = 0; i < N; i++) 62 { 63 arr[i].a = i; 64 arr[i].b = i * 2; 65 asm volatile ("" ::: "memory"); 66 } 67 68 main1 (arr); 69 70 return 0; 71 } 72 73 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target vect_strided2 } } } */ 74 75