| 1 |
/* { dg-do compile { target { ! ia32 } } } */ |
| 2 |
/* { dg-options "-O3 -mapxf" } */ |
| 3 |
|
| 4 |
int foo(int a, int b, int c, int d) |
| 5 |
{ |
| 6 |
int sum = a; |
| 7 |
|
| 8 |
if (a != c) |
| 9 |
{ |
| 10 |
c += d; |
| 11 |
a += b; |
| 12 |
sum += a + c; |
| 13 |
if (b != d && sum < c || sum > d) |
| 14 |
{ |
| 15 |
b -= d; |
| 16 |
sum -= b; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
return sum; |
| 21 |
} |
| 22 |
|
| 23 |
int foo2 (unsigned a, unsigned b, unsigned d, unsigned e, int *p) |
| 24 |
{ |
| 25 |
unsigned r; |
| 26 |
int c = __builtin_mul_overflow (a, b, &r); |
| 27 |
*p += a; |
| 28 |
return c ? d : e; |
| 29 |
} |
| 30 |
|
| 31 |
/* { dg-final { scan-assembler-not "set" } } */ |
| 32 |
|