libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u32-i4.c
blob8f58e24c4a8b8be2da0a6c136924a370b9952691
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 } s;
15 __attribute__ ((noinline)) int
16 main1 (s *arr)
18 int i;
19 s *ptr = arr;
20 s res[N];
22 for (i = 0; i < N; i++)
24 res[i].c = ptr->b - ptr->a + ptr->d - ptr->c;
25 res[i].a = ptr->a + ptr->c + ptr->b + ptr->d;
26 res[i].d = ptr->b - ptr->a + ptr->d - ptr->c;
27 res[i].b = ptr->b - ptr->a + ptr->d - ptr->c;
28 ptr++;
31 /* check results: */
32 #pragma GCC novector
33 for (i = 0; i < N; i++)
35 if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
36 || res[i].a != arr[i].a + arr[i].c + arr[i].b + arr[i].d
37 || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
38 || res[i].b != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
39 abort ();
42 return 0;
45 int main (void)
47 int i;
48 s arr[N];
50 check_vect ();
52 for (i = 0; i < N; i++)
54 arr[i].a = i;
55 arr[i].b = i * 2;
56 arr[i].c = 17;
57 arr[i].d = i+34;
58 asm volatile ("" ::: "memory");
61 main1 (arr);
63 return 0;
66 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided4 } } } */