| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -fdump-tree-ifcvt" } */ |
| 3 |
|
| 4 |
int foo1 (unsigned short a[], unsigned int x) |
| 5 |
{ |
| 6 |
unsigned int i; |
| 7 |
for (i = 0; i < 1000; i++) |
| 8 |
{ |
| 9 |
x = a[i]; |
| 10 |
a[i] = (unsigned short)(x >= 32768 ? x - 32768 : 0); |
| 11 |
} |
| 12 |
return x; |
| 13 |
} |
| 14 |
|
| 15 |
int foo2 (unsigned short a[], unsigned int x) |
| 16 |
{ |
| 17 |
unsigned int i; |
| 18 |
for (i = 0; i < 1000; i++) |
| 19 |
{ |
| 20 |
x = a[i]; |
| 21 |
a[i] = (unsigned short)(x > 32768 ? x - 32768 : 0); |
| 22 |
} |
| 23 |
return x; |
| 24 |
} |
| 25 |
|
| 26 |
int foo3 (unsigned short a[], unsigned int x) |
| 27 |
{ |
| 28 |
unsigned int i; |
| 29 |
for (i = 0; i < 1000; i++) |
| 30 |
{ |
| 31 |
x = a[i]; |
| 32 |
a[i] = (unsigned short)(x > 1000 ? x - 1000 : 0); |
| 33 |
} |
| 34 |
return x; |
| 35 |
} |
| 36 |
|
| 37 |
int foo4 (unsigned short a[], unsigned int x) |
| 38 |
{ |
| 39 |
unsigned int i; |
| 40 |
for (i = 0; i < 1000; i++) |
| 41 |
{ |
| 42 |
x = a[i]; |
| 43 |
a[i] = (unsigned short)(x >= 2 ? x - 32768 : 32770); |
| 44 |
} |
| 45 |
return x; |
| 46 |
} |
| 47 |
|
| 48 |
/* { dg-final { scan-tree-dump-times "MAX_EXPR " 4 "ifcvt" } } */ |