OSDN Git Service

PR tree-optimization/35982
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-14.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 64
7
8 __attribute__ ((noinline)) unsigned short
9 foo (short scale){
10   int i;
11   unsigned short j;
12   unsigned short sum = 0;
13   unsigned short sum_j;
14
15   for (i = 0; i < N; i++) {
16     sum_j = 0;
17     for (j = 0; j < N; j++) {
18       sum_j += j;
19     }
20     sum += sum_j;
21   }
22   return sum;
23 }
24
25 __attribute__ ((noinline)) unsigned short
26 bar (void)
27 {
28   unsigned short j;
29   unsigned short sum_j;
30     sum_j = 0;
31     for (j = 0; j < N; j++) {
32       sum_j += j;
33     }
34   return sum_j;
35 }
36
37 int main (void)
38 {
39   int i;
40   unsigned short j, sum_j;
41   unsigned short sum = 0;
42   unsigned short res;
43
44   check_vect ();
45
46   res = foo (2);
47
48   /* check results:  */
49   for (i=0; i<N; i++)
50     {
51       sum_j = bar();
52       sum += sum_j;
53     }
54   if (res != sum)
55     abort ();
56
57   return 0;
58 }
59
60 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { target vect_widen_mult_hi_to_si } } } */
61 /* { dg-final { cleanup-tree-dump "vect" } } */