gcc/testsuite/gcc.dg/crc-not-crc-6.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fdump-tree-crc -O2" } */ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #define POLY (0x1070U << 3) |
| 7 | #define u8 uint8_t |
| 8 | #define u16 uint16_t |
| 9 | |
| 10 | //xor in case 0 |
| 11 | u8 not_crc(u16 data) { |
| 12 | int i; |
| 13 | for (i = 0; i < 8; i++) { |
| 14 | if (data & 0x0000) |
| 15 | data = data ^ POLY; |
| 16 | data = data << 1; |
| 17 | } |
| 18 | return (u8)(data >> 8); |
| 19 | } |
| 20 | |
| 21 | /* { dg-final { scan-tree-dump-times "not_crc function maybe contains CRC calculation" 0 "crc" } } */ |
| 22 | |
| 23 |