| 1 |
/* PR tree-optimization/112994 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 4 |
/* { dg-final { scan-tree-dump-times "return 2;" 3 "optimized" } } */ |
| 5 |
/* { dg-final { scan-tree-dump-times "return 7;" 3 "optimized" } } */ |
| 6 |
/* { dg-final { scan-tree-dump-times "return -7;" 2 "optimized" } } */ |
| 7 |
|
| 8 |
int f1 (int x) { return (x * 4) / (x * 2); } |
| 9 |
int f2 (int x) { return (x * 56) / (x * 8); } |
| 10 |
int f3 (int x) { return (x * 56) / (x * -8); } |
| 11 |
int f4 (int x) { int y = x * 4; return y / (x * 2); } |
| 12 |
int f5 (int x) { int y = x * 56; return y / (x * 8); } |
| 13 |
int f6 (int x) { int y = x * 56; return y / (x * -8); } |
| 14 |
unsigned f7 (unsigned x) { if (x > ~0U / 4) __builtin_unreachable (); unsigned y = x * 4; return y / (x * 2); } |
| 15 |
unsigned f8 (unsigned x) { if (x > ~0U / 56) __builtin_unreachable (); unsigned y = x * 56; return y / (x * 8); } |