2010-06-16 Mikael Pettersson <mikpe@it.uu.se>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u16-i2.c
blobeb6ecc69bd463adfa16fb41f3a0418c074d4c1cd
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 } s;
13 __attribute__ ((noinline)) int
14 main1 (s *arr)
16 s *ptr = arr;
17 s res[N];
18 int i;
20 for (i = 0; i < N; i++)
22 res[i].a = ptr->b - ptr->a;
23 res[i].b = ptr->b + ptr->a;
24 ptr++;
27 /* check results: */
28 for (i = 0; i < N; i++)
30 if (res[i].a != arr[i].b - arr[i].a
31 || res[i].b != arr[i].a + arr[i].b)
32 abort ();
35 return 0;
38 int main (void)
40 int i;
41 s arr[N];
43 check_vect ();
45 for (i = 0; i < N; i++)
47 arr[i].a = i;
48 arr[i].b = i * 2;
49 if (arr[i].a == 178)
50 abort();
53 main1 (arr);
55 return 0;
58 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
59 /* { dg-final { cleanup-tree-dump "vect" } } */