re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / 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" { 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 for (pi = 0; pi < (512)*(512); pi++) {
15 int zr = zr_in[pi];
16 int zi = zi_in[pi];
17 int zk = zk_in[pi];
18
19 if (zr*zr + zi*zi >= 4) {
20 tmp_r = zr;
21 tmp_i = zi;
22 tmp_k = zk;
23 } else {
24 tmp_r = (zr*zr - zi*zi + cr);
25 tmp_i = (2 * zr * zi + ci);
26 tmp_k = zk + 1;
27 }
28 zr_out[pi] = tmp_r;
29 zi_out[pi] = tmp_i;
30 zk_out[pi] = tmp_k;
31 }
32 }
33
34
35 /* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */
36 /* { dg-final { cleanup-tree-dump "ifcvt" } } */