gcc/testsuite/gcc.dg/crc-not-crc-8.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fdump-tree-crc -O2" } */ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | //xor is done in case lsb is 0 |
| 7 | int16_t not_crc(int16_t crc, int8_t a) { |
| 8 | int i; |
| 9 | crc ^= a; |
| 10 | for (i = 0; i < 8; ++i) { |
| 11 | if (crc << 15 == 0) |
| 12 | crc = (crc >> 1) ^ 0xA001; |
| 13 | else |
| 14 | crc = crc >> 1; |
| 15 | } |
| 16 | return crc; |
| 17 | } |
| 18 | |
| 19 | /* { dg-final { scan-tree-dump-times "not_crc function maybe contains CRC calculation" 0 "crc" } } */ |
| 20 |