aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-34.c
blob: 1a5687a527b64da2085706e5b3618a062f5b1dbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* { dg-do compile } */ 
/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */

void bar (int);

#define M 16
#define N 8

short foo (short image[][M], short block[][N]){
  int sad, diff = 0;                                
  int i, j;        
  int tmp;

  for (i = 0; i < N; i++) {
    sad = 0;          
    for (j = 0; j < N; j++) {
      tmp = image[i][j] - block[i][j];
      sad += (tmp < 0) ? -tmp : tmp;
    }
    diff += sad; 
  }

  return diff;
}

/* The following evolution functions have to be detected:
   
   i  ->  {0, +, 1}_1
   j  ->  {0, +, 1}_2

*/

/* { dg-final { diff-tree-dumps "ddall" } } */