| 1 |
/* PR target/112600 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
/* { dg-final { scan-assembler-times "sbb|cmov" 4 } } */ |
| 5 |
|
| 6 |
unsigned char |
| 7 |
sub_sat_char (unsigned char x, unsigned char y) |
| 8 |
{ |
| 9 |
unsigned char res; |
| 10 |
res = x - y; |
| 11 |
res &= -(x >= y); |
| 12 |
return res; |
| 13 |
} |
| 14 |
|
| 15 |
unsigned short |
| 16 |
sub_sat_short (unsigned short x, unsigned short y) |
| 17 |
{ |
| 18 |
unsigned short res; |
| 19 |
res = x - y; |
| 20 |
res &= -(x >= y); |
| 21 |
return res; |
| 22 |
} |
| 23 |
|
| 24 |
unsigned int |
| 25 |
sub_sat_int (unsigned int x, unsigned int y) |
| 26 |
{ |
| 27 |
unsigned int res; |
| 28 |
res = x - y; |
| 29 |
res &= -(x >= y); |
| 30 |
return res; |
| 31 |
} |
| 32 |
|
| 33 |
unsigned long |
| 34 |
sub_sat_long (unsigned long x, unsigned long y) |
| 35 |
{ |
| 36 |
unsigned long res; |
| 37 |
res = x - y; |
| 38 |
res &= -(x >= y); |
| 39 |
return res; |
| 40 |
} |