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