(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
ifc-20040816-2.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats-blocks-details" { target *-*-* } } */
       3  
       4  void foo(const int * __restrict__ zr_in,
       5  		const int * __restrict__ zi_in,
       6  		const int * __restrict__ zk_in,
       7  		int * __restrict__ zr_out,
       8  		int * __restrict__ zi_out,
       9  		int * __restrict__ zk_out,
      10  		int cr, int ci)
      11  {
      12    unsigned int pi;
      13    int tmp_r, tmp_i, tmp_k;
      14  #if __SIZEOF_INT__ >= 4
      15    for (pi = 0; pi < (512)*(512); pi++) {
      16  #else
      17    for (pi = 0; pi < (32)*(32); pi++) {
      18  #endif
      19      int zr = zr_in[pi];
      20      int zi = zi_in[pi];
      21      int zk = zk_in[pi];
      22      
      23      if (zr*zr + zi*zi >= 4) {
      24        tmp_r = zr;
      25        tmp_i = zi;
      26        tmp_k = zk;
      27      } else {
      28        tmp_r = (zr*zr - zi*zi + cr);
      29        tmp_i = (2 * zr * zi + ci);
      30        tmp_k = zk + 1;
      31      }
      32      zr_out[pi] = tmp_r;
      33      zi_out[pi] = tmp_i;
      34      zk_out[pi] = tmp_k;
      35    }
      36  }
      37  
      38  
      39  /* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */
      40  
      41  /* We insert into code
      42     if (LOOP_VECTORIZED (...))
      43     which is folded by vectorizer.  Both outgoing edges must have probability
      44     100% so the resulting profile match after folding.  */
      45  /* { dg-final { scan-tree-dump-times "Invalid sum of outgoing probabilities 200.0" 1 "ifcvt" } } */
      46  /* { dg-final { scan-tree-dump-times "Invalid sum of incoming counts" 1 "ifcvt" } } */