111
|
1 /* { dg-require-effective-target vect_int } */
|
|
2
|
|
3 #include <stdarg.h>
|
|
4 #include "tree-vect.h"
|
|
5
|
|
6 #define N 128
|
|
7
|
|
8 typedef struct {
|
|
9 unsigned short a;
|
|
10 unsigned short b;
|
|
11 unsigned short c;
|
|
12 unsigned short d;
|
|
13 } s;
|
|
14
|
|
15 __attribute__ ((noinline)) int
|
|
16 main1 ()
|
|
17 {
|
|
18 s arr[N];
|
|
19 s *ptr = arr;
|
|
20 s res[N];
|
|
21 int i;
|
|
22
|
|
23 for (i = 0; i < N; i++)
|
|
24 {
|
|
25 arr[i].a = i;
|
|
26 arr[i].b = i * 2;
|
|
27 arr[i].c = 17;
|
|
28 arr[i].d = i+34;
|
131
|
29 asm volatile ("" ::: "memory");
|
111
|
30 }
|
|
31
|
|
32 for (i = 0; i < N; i++)
|
|
33 {
|
|
34 unsigned short x, y, z, w;
|
|
35 x = ptr->b - ptr->a;
|
|
36 y = ptr->d - ptr->c;
|
|
37 res[i].c = x + y;
|
|
38 z = ptr->a + ptr->c;
|
|
39 w = ptr->b + ptr->d;
|
|
40 res[i].a = z + w;
|
|
41 res[i].d = x + y;
|
|
42 res[i].b = x + y;
|
|
43 ptr++;
|
|
44 }
|
|
45
|
|
46 /* check results: */
|
|
47 for (i = 0; i < N; i++)
|
|
48 {
|
|
49 if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
|
|
50 || res[i].a != arr[i].a + arr[i].c + arr[i].b + arr[i].d
|
|
51 || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
|
|
52 || res[i].b != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
|
|
53 abort ();
|
|
54 }
|
|
55
|
|
56 return 0;
|
|
57 }
|
|
58
|
|
59 int main (void)
|
|
60 {
|
|
61 int i;
|
|
62
|
|
63 check_vect ();
|
|
64
|
|
65 main1 ();
|
|
66
|
|
67 return 0;
|
|
68 }
|
|
69
|
|
70 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided4 } } } */
|
|
71
|