gcc/testsuite/gcc.dg/torture/pr75964.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | typedef __UINT8_TYPE__ uint8_t; |
| 4 | |
| 5 | uint8_t __attribute__ ((noinline, noclone)) |
| 6 | abs8 (uint8_t x) |
| 7 | { |
| 8 | if (x & 0x80) |
| 9 | x = -x; |
| 10 | |
| 11 | if (x & 0x80) |
| 12 | x = 0x7f; |
| 13 | |
| 14 | return x; |
| 15 | } |
| 16 | |
| 17 | int |
| 18 | main (void) |
| 19 | { |
| 20 | if (abs8 (0) != 0 |
| 21 | || abs8 (1) != 1 |
| 22 | || abs8 (127) != 127 |
| 23 | || abs8 (128) != 127 |
| 24 | || abs8 (129) != 127 |
| 25 | || abs8 (255) != 1) |
| 26 | __builtin_abort (); |
| 27 | return 0; |
| 28 | } |