2010-06-16 Mikael Pettersson <mikpe@it.uu.se>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-a-u16-mult.c
blobafb2f4697bc3637ea13776c0e97d279585eb3ceb
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 ()
16 s arr[N];
17 s *ptr = arr;
18 unsigned int iarr[N];
19 unsigned int *iptr = iarr;
20 s res[N];
21 unsigned int ires[N];
22 int i;
24 for (i = 0; i < N; i++)
26 arr[i].a = i;
27 arr[i].b = i * 2;
28 iarr[i] = i * 3;
29 if (arr[i].a == 178)
30 abort();
33 for (i = 0; i < N; i++)
35 ires[i] = *iptr;
36 res[i].b = ptr->b - ptr->a;
37 res[i].a = ptr->b + ptr->a;
38 iptr++;
39 ptr++;
42 /* check results: */
43 for (i = 0; i < N; i++)
45 if (res[i].b != arr[i].b - arr[i].a
46 || ires[i] != iarr[i]
47 || res[i].a != arr[i].b + arr[i].a)
48 abort ();
51 return 0;
54 int main (void)
56 int i;
58 check_vect ();
60 main1 ();
62 return 0;
65 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
66 /* { dg-final { cleanup-tree-dump "vect" } } */