PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u8-i8-gap2-big-array.c
blobcc1b94989149c847ae63c45063a22d20fe1ae196
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 s check_res[N];
21 __attribute__ ((noinline)) int
22 main1 (s *arr)
24 int i;
25 s *ptr = arr;
26 s res[N];
28 for (i = 0; i < N; i++)
30 res[i].c = ptr->b;
31 res[i].a = ptr->f + ptr->b;
32 res[i].d = ptr->f - ptr->b;
33 res[i].b = ptr->f;
34 res[i].f = ptr->b;
35 res[i].e = ptr->f - ptr->b;
36 res[i].h = ptr->f;
37 res[i].g = ptr->f - ptr->b;
38 ptr++;
41 /* check results: */
42 for (i = 0; i < N; i++)
44 if (res[i].a != check_res[i].a
45 || res[i].b != check_res[i].b
46 || res[i].c != check_res[i].c
47 || res[i].d != check_res[i].d
48 || res[i].e != check_res[i].e
49 || res[i].f != check_res[i].f
50 || res[i].g != check_res[i].g
51 || res[i].h != check_res[i].h)
52 abort ();
57 int main (void)
59 int i;
60 s arr[N];
62 check_vect ();
64 for (i = 0; i < N; i++)
66 arr[i].a = i;
67 arr[i].b = i * 2;
68 arr[i].c = 17;
69 arr[i].d = i+34;
70 arr[i].e = i + 5;
71 arr[i].f = i * 2 + 2;
72 arr[i].g = i - 3;
73 arr[i].h = 56;
75 check_res[i].c = arr[i].b;
76 check_res[i].a = arr[i].f + arr[i].b;
77 check_res[i].d = arr[i].f - arr[i].b;
78 check_res[i].b = arr[i].f;
79 check_res[i].f = arr[i].b;
80 check_res[i].e = arr[i].f - arr[i].b;
81 check_res[i].h = arr[i].f;
82 check_res[i].g = arr[i].f - arr[i].b;
83 if (arr[i].a == 178)
84 abort ();
87 main1 (arr);
89 return 0;
92 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
93 /* { dg-final { cleanup-tree-dump "vect" } } */