| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fdump-tree-crc-details" } */ |
| 3 |
/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */ |
| 4 |
|
| 5 |
//We just don't check cases when the polynomial is a variable, as we can't replace it. |
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
uint16_t crc16(uint16_t crc, uint8_t a, uint16_t polynom) { |
| 9 |
int i; |
| 10 |
crc ^= a; |
| 11 |
for (i = 0; i < 8; ++i) { |
| 12 |
if (crc & 1) |
| 13 |
crc = (crc >> 1) ^ polynom; |
| 14 |
else |
| 15 |
crc = (crc >> 1); |
| 16 |
} |
| 17 |
return crc; |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-final { scan-tree-dump "Second operand of the xor statement isn't an integer constant.\n" "crc" } } */ |