2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-a-u16-i4.c
blob93c1b582ca8786f57bb1543aaa8601902fc55ced
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 short a;
10 unsigned short b;
11 unsigned short c;
12 unsigned short d;
13 } s;
15 __attribute__ ((noinline)) int
16 main1 ()
18 s arr[N];
19 s *ptr = arr;
20 s res[N];
21 int i;
22 unsigned short x, y, z, w;
24 for (i = 0; i < N; i++)
26 arr[i].a = i;
27 arr[i].b = i * 2;
28 arr[i].c = 17;
29 arr[i].d = i+34;
30 if (arr[i].a == 178)
31 abort();
34 for (i = 0; i < N; i++)
36 x = ptr->b - ptr->a;
37 y = ptr->d - ptr->c;
38 res[i].c = x + y;
39 z = ptr->a + ptr->c;
40 w = ptr->b + ptr->d;
41 res[i].a = z + w;
42 res[i].d = x + y;
43 res[i].b = x + y;
44 ptr++;
47 /* check results: */
48 for (i = 0; i < N; i++)
50 if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
51 || res[i].a != arr[i].a + arr[i].c + arr[i].b + arr[i].d
52 || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
53 || res[i].b != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
54 abort ();
57 return 0;
60 int main (void)
62 int i;
64 check_vect ();
66 main1 ();
68 return 0;
71 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
72 /* { dg-final { cleanup-tree-dump "vect" } } */