| 1 |
/* { dg-options "-O2 -fdump-tree-phiopt" } */ |
| 2 |
|
| 3 |
int f0(int A) |
| 4 |
{ |
| 5 |
// A == 0? A : -A same as -A |
| 6 |
if (A == 0) return A; |
| 7 |
return -A; |
| 8 |
} |
| 9 |
|
| 10 |
int f1(int A) |
| 11 |
{ |
| 12 |
// A != 0? A : -A same as A |
| 13 |
if (A != 0) return A; |
| 14 |
return -A; |
| 15 |
} |
| 16 |
int f2(int A) |
| 17 |
{ |
| 18 |
// A >= 0? A : -A same as abs (A) |
| 19 |
if (A >= 0) return A; |
| 20 |
return -A; |
| 21 |
} |
| 22 |
int f3(int A) |
| 23 |
{ |
| 24 |
// A > 0? A : -A same as abs (A) |
| 25 |
if (A > 0) return A; |
| 26 |
return -A; |
| 27 |
} |
| 28 |
int f4(int A) |
| 29 |
{ |
| 30 |
// A <= 0? A : -A same as -abs (A) |
| 31 |
if (A <= 0) return A; |
| 32 |
return -A; |
| 33 |
} |
| 34 |
int f5(int A) |
| 35 |
{ |
| 36 |
// A < 0? A : -A same as -abs (A) |
| 37 |
if (A < 0) return A; |
| 38 |
return -A; |
| 39 |
} |
| 40 |
|
| 41 |
/* f4 and f5 are not allowed to be optimized in early phi-opt. */ |
| 42 |
/* { dg-final { scan-tree-dump-times "if" 2 "phiopt1" } } */ |
| 43 |
/* { dg-final { scan-tree-dump-not "if" "phiopt2" } } */ |
| 44 |
|