| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-phiopt1-details -fdump-tree-phiopt2-details -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
#define SAT(x) (x < 0 ? 0 : (x > 255 ? 255 : x)) |
| 5 |
|
| 6 |
unsigned char |
| 7 |
foo (unsigned char *p, int i) |
| 8 |
{ |
| 9 |
if (i < 0) |
| 10 |
return 0; |
| 11 |
{ |
| 12 |
int t; |
| 13 |
if (i > 255) |
| 14 |
t = 255; |
| 15 |
else |
| 16 |
t = i; |
| 17 |
return t; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
/* Because of the way PHIOPT works, it only does the merging of BBs after it is done so we get the case were we can't |
| 22 |
optimize the above until phiopt2 right now. */ |
| 23 |
/* { dg-final { scan-tree-dump-times "COND_EXPR .*and PHI .*converted to straightline code" 2 "phiopt1" { xfail *-*-* } } } */ |
| 24 |
/* { dg-final { scan-tree-dump-times "COND_EXPR .*and PHI .*converted to straightline code" 0 "phiopt2" { xfail *-*-* } } } */ |
| 25 |
/* { dg-final { scan-tree-dump-times "= MIN_EXPR" 1 "phiopt1" } } */ |
| 26 |
/* { dg-final { scan-tree-dump-times "= MAX_EXPR" 1 "phiopt1" { xfail *-*-* } } } */ |
| 27 |
/* { dg-final { scan-tree-dump-times "= MIN_EXPR" 1 "optimized" } } */ |
| 28 |
/* { dg-final { scan-tree-dump-times "= MAX_EXPR" 1 "optimized" } } */ |