| 1 |
/* { dg-options "-O -fdump-tree-optimized" } */ |
| 2 |
|
| 3 |
int res[4]; |
| 4 |
|
| 5 |
void |
| 6 |
f1 (int x, int y) |
| 7 |
{ |
| 8 |
res[2] = __builtin_add_overflow (x, y, res + 0); |
| 9 |
res[3] = __builtin_add_overflow (y, x, res + 1); |
| 10 |
} |
| 11 |
|
| 12 |
void |
| 13 |
f2 (int x, int y) |
| 14 |
{ |
| 15 |
res[2] = __builtin_sub_overflow (x, y, res + 0); |
| 16 |
res[3] = __builtin_sub_overflow (y, x, res + 1); |
| 17 |
} |
| 18 |
|
| 19 |
void |
| 20 |
f3 (int x, int y) |
| 21 |
{ |
| 22 |
res[2] = __builtin_mul_overflow (x, y, res + 0); |
| 23 |
res[3] = __builtin_mul_overflow (y, x, res + 1); |
| 24 |
} |
| 25 |
|
| 26 |
/* { dg-final { scan-tree-dump-times {\.ADD_OVERFLOW} 1 "optimized" } } */ |
| 27 |
/* { dg-final { scan-tree-dump-times {\.SUB_OVERFLOW} 2 "optimized" } } */ |
| 28 |
/* { dg-final { scan-tree-dump-times {\.MUL_OVERFLOW} 1 "optimized" } } */ |