diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/crc-22.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-22.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/crc-22.c b/gcc/testsuite/gcc.dg/crc-22.c new file mode 100644 index 0000000..153eb6b --- /dev/null +++ b/gcc/testsuite/gcc.dg/crc-22.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-crc" } */ + +#include <stdint.h> + +uint8_t not_crc(uint8_t crc, uint8_t data) { + uint8_t i; + crc = crc ^ data; + for (i = 0; i < 8; i++) { + if (data & 0x01) + crc = (crc >> 1) ^ 0x8C; + else + crc >>= 1; + } + return crc; +} +/* { dg-final { scan-tree-dump-times "Attention! not_crc function calculates CRC." 0 "crc"} } */ |