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