Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-early-break_22.c

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