2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-a-u8-i8-gap2-big-array.c
blob2add5b489915cffda25f3c59b41bd1c44edf16ce
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 typedef struct {
9 unsigned char a;
10 unsigned char b;
11 unsigned char c;
12 unsigned char d;
13 unsigned char e;
14 unsigned char f;
15 unsigned char g;
16 unsigned char h;
17 } s;
19 __attribute__ ((noinline)) int
20 main1 ()
22 int i;
23 s arr[N];
24 s *ptr = arr;
25 s check_res[N];
26 s res[N];
28 for (i = 0; i < N; i++)
30 arr[i].a = i;
31 arr[i].b = i * 2;
32 arr[i].c = 17;
33 arr[i].d = i+34;
34 arr[i].e = i + 5;
35 arr[i].f = i * 2 + 2;
36 arr[i].g = i - 3;
37 arr[i].h = 56;
39 check_res[i].c = arr[i].a;
40 check_res[i].a = arr[i].f + arr[i].a;
41 check_res[i].d = arr[i].f - arr[i].a;
42 check_res[i].b = arr[i].f;
43 check_res[i].f = arr[i].a;
44 check_res[i].e = arr[i].f - arr[i].a;
45 check_res[i].h = arr[i].f;
46 check_res[i].g = arr[i].f - arr[i].a;
48 asm volatile ("" ::: "memory");
51 for (i = 0; i < N; i++)
53 res[i].c = ptr->a;
54 res[i].a = ptr->f + ptr->a;
55 res[i].d = ptr->f - ptr->a;
56 res[i].b = ptr->f;
57 res[i].f = ptr->a;
58 res[i].e = ptr->f - ptr->a;
59 res[i].h = ptr->f;
60 res[i].g = ptr->f - ptr->a;
61 ptr++;
64 /* check results: */
65 for (i = 0; i < N; i++)
67 if (res[i].a != check_res[i].a
68 || res[i].b != check_res[i].b
69 || res[i].c != check_res[i].c
70 || res[i].d != check_res[i].d
71 || res[i].e != check_res[i].e
72 || res[i].f != check_res[i].f
73 || res[i].g != check_res[i].g
74 || res[i].h != check_res[i].h)
75 abort ();
80 int main (void)
82 check_vect ();
84 main1 ();
86 return 0;
89 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */