PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u8-i8-gap2.c
blob349e869392609be6894ac0634d06ac6f2644a29f
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
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 (s *arr)
22 int i;
23 s *ptr = arr;
24 s res[N];
26 for (i = 0; i < N; i++)
28 res[i].c = ptr->b;
29 res[i].a = ptr->f + ptr->b;
30 res[i].d = ptr->f - ptr->b;
31 res[i].b = ptr->f;
32 res[i].f = ptr->b;
33 res[i].e = ptr->f - ptr->b;
34 res[i].h = ptr->f;
35 res[i].g = ptr->f - ptr->b;
36 ptr++;
39 /* check results: */
40 for (i = 0; i < N; i++)
42 if (res[i].c != arr[i].b
43 || res[i].a != arr[i].f + arr[i].b
44 || res[i].d != arr[i].f - arr[i].b
45 || res[i].b != arr[i].f
46 || res[i].f != arr[i].b
47 || res[i].e != arr[i].f - arr[i].b
48 || res[i].h != arr[i].f
49 || res[i].g != arr[i].f - arr[i].b)
50 abort();
55 int main (void)
57 int i;
58 s arr[N];
60 check_vect ();
62 for (i = 0; i < N; i++)
64 arr[i].a = i;
65 arr[i].b = i * 2;
66 arr[i].c = 17;
67 arr[i].d = i+34;
68 arr[i].e = i + 5;
69 arr[i].f = i * 2 + 2;
70 arr[i].g = i - 3;
71 arr[i].h = 56;
72 if (arr[i].a == 178)
73 abort();
76 main1 (arr);
78 return 0;
81 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
82 /* { dg-final { cleanup-tree-dump "vect" } } */