1 /* { dg-do run } */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-require-effective-target vect_perm } */
4
5 #include "tree-vect.h"
6
7 void __attribute__((noipa))
8 foo (int * __restrict__ a, short * __restrict__ b, int * __restrict__ c)
9 {
10 int t1 = *c;
11 int t2 = *c;
12 for (int i = 0; i < 64; i+=2)
13 {
14 b[i] = a[i] - t1;
15 t1 = a[i];
16 b[i+1] = a[i+1] - t2;
17 t2 = a[i+1];
18 }
19 }
20
21 int a[64];
22 short b[64];
23
24 int
25 main ()
26 {
27 check_vect ();
28 for (int i = 0; i < 64; ++i)
29 {
30 a[i] = i;
31 __asm__ volatile ("" ::: "memory");
32 }
33 int c = 7;
34 foo (a, b, &c);
35 for (int i = 2; i < 64; i+=2)
36 if (b[i] != a[i] - a[i-2]
37 || b[i+1] != a[i+1] - a[i-1])
38 abort ();
39 if (b[0] != -7 || b[1] != -6)
40 abort ();
41 return 0;
42 }
43
44 /* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */