libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u32-mult.c
blob0c2bd9d8cbde5e789474595db519d603b374e74c
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 int a;
10 unsigned int b;
11 } ii;
13 __attribute__ ((noinline)) int
14 main1 (unsigned short *arr, ii *iarr)
16 unsigned short *ptr = arr;
17 ii *iptr = iarr;
18 unsigned short res[N];
19 ii ires[N];
20 int i;
22 for (i = 0; i < N; i++)
24 ires[i].a = iptr->b - iptr->a;
25 ires[i].b = iptr->b + iptr->a;
26 res[i] = *ptr;
27 iptr++;
28 ptr++;
31 /* check results: */
32 #pragma GCC novector
33 for (i = 0; i < N; i++)
35 if (res[i] != arr[i]
36 || ires[i].a != iarr[i].b - iarr[i].a
37 || ires[i].b != iarr[i].b + iarr[i].a)
38 abort ();
41 return 0;
44 int main (void)
46 int i;
47 unsigned short arr[N];
48 ii iarr[N];
50 check_vect ();
52 for (i = 0; i < N; i++)
54 arr[i] = i;
55 iarr[i].a = i;
56 iarr[i].b = i * 3;
57 __asm__ volatile ("");
59 main1 (arr, iarr);
61 return 0;
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided2 } } } */