Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u16-i4.c
blob90e58166669b36be2690ff09df985df230951392
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 volatile int y = 0;
17 __attribute__ ((noinline)) int
18 main1 (s *arr)
20 int i;
21 s *ptr = arr;
22 s res[N];
23 unsigned short x, y, z, w;
25 for (i = 0; i < N; i++)
27 x = ptr->b - ptr->a;
28 y = ptr->d - ptr->c;
29 res[i].c = x + y;
30 z = ptr->a + ptr->c;
31 w = ptr->b + ptr->d;
32 res[i].a = z + w;
33 res[i].d = x + y;
34 res[i].b = x + y;
35 ptr++;
38 /* check results: */
39 for (i = 0; i < N; i++)
41 if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
42 || res[i].a != arr[i].a + arr[i].c + arr[i].b + arr[i].d
43 || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
44 || res[i].b != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
45 abort ();
48 return 0;
51 int main (void)
53 int i;
54 s arr[N];
56 check_vect ();
58 for (i = 0; i < N; i++)
60 arr[i].a = i;
61 arr[i].b = i * 2;
62 arr[i].c = 17;
63 arr[i].d = i+34;
64 if (y) /* Avoid vectorization. */
65 abort ();
68 main1 (arr);
70 return 0;
73 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided4 } } } */