Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u32-i8.c
blob5f5a66e631868e5ed8115dacbecf7b24b030e9af
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 typedef struct {
9 int a;
10 int b;
11 int c;
12 int d;
13 int e;
14 int f;
15 int g;
16 int 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 - ptr->a + ptr->d - ptr->c;
29 res[i].a = ptr->a + ptr->g + ptr->b + ptr->d;
30 res[i].d = ptr->b - ptr->a + ptr->d - ptr->c;
31 res[i].b = ptr->h - ptr->a + ptr->d - ptr->c;
32 res[i].f = ptr->f + ptr->h;
33 res[i].e = ptr->b - ptr->e;
34 res[i].h = ptr->d - ptr->g;
35 res[i].g = ptr->b - ptr->a + ptr->d - ptr->c;
36 ptr++;
39 /* check results: */
40 for (i = 0; i < N; i++)
42 if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
43 || res[i].a != arr[i].a + arr[i].g + arr[i].b + arr[i].d
44 || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
45 || res[i].b != arr[i].h - arr[i].a + arr[i].d - arr[i].c
46 || res[i].f != arr[i].f + arr[i].h
47 || res[i].e != arr[i].b - arr[i].e
48 || res[i].h != arr[i].d - arr[i].g
49 || res[i].g != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
50 abort();
54 int main (void)
56 int i;
57 s arr[N];
59 check_vect ();
61 for (i = 0; i < N; i++)
63 arr[i].a = i;
64 arr[i].b = i * 2;
65 arr[i].c = 17;
66 arr[i].d = i+34;
67 arr[i].e = i * 3 + 5;
68 arr[i].f = i * 5;
69 arr[i].g = i - 3;
70 arr[i].h = 56;
71 if (arr[i].a == 178)
72 abort();
75 main1 (arr);
77 return 0;
80 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
81 /* { dg-final { cleanup-tree-dump "vect" } } */