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