Debian Codegraph @

gcc/testsuite/gcc.dg/vect/slp-reduc-2.c

raw
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-require-effective-target vect_perm } */
5
6 #include <stdarg.h>
7 #include "tree-vect.h"
8
9 #define N 16
10
11 unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
12 unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
13
14 /* Vectorization of reduction using loop-aware SLP (with unrolling). */
15
16 __attribute__ ((noinline))
17 int main1 (int n, int res0, int res1, int res2, int res3)
18 {
19 int i;
20 unsigned int udiff0 = 5, udiff1 = 10;
21
22 for (i = 0; i < n; i++) {
23 udiff1 += (ub[2*i + 1] - uc[2*i + 1]);
24 udiff0 += (ub[2*i] - uc[2*i]);
25 }
26
27 /* Check results: */
28 if (udiff0 != res0
29 || udiff1 != res1)
30 abort ();
31
32 return 0;
33 }
34
35 int main (void)
36 {
37 check_vect ();
38
39 main1 (N/2, 117, 138, 84, 102);
40 return 0;
41 }
42
43 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
44 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_add } } } */
45 /* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
46