Debian Codegraph @

gcc/testsuite/gcc.dg/torture/crc-2.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc-details" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
4
5 #define CRC16_CCITT 0x102
6 #define POLYNOM CRC16_CCITT
7
8 unsigned int crc16 (unsigned int crcValue, unsigned char newByte) {
9 unsigned char i;
10
11 for (i = 0; i < 8; i++) {
12
13 if (((crcValue & 0x8000) >> 8) ^ (newByte & 0x80)) {
14 crcValue = (crcValue << 1) ^ POLYNOM;
15 } else {
16 crcValue = (crcValue << 1);
17 }
18
19 newByte <<= 1;
20 }
21
22 return crcValue;
23 }
24
25 /* { dg-final { scan-tree-dump "function maybe contains CRC calculation." "crc" } } */
26 /* { dg-final { scan-tree-dump "Loop iteration number is 7" "crc" } } */
27 /* { dg-final { scan-tree-dump "Bit forward" "crc" } } */
28 /* { dg-final { scan-tree-dump "Polynomial's value is \\\{\[0, \]*1, 0, 0, 0, 0, 0, 0, 1, 0\\\}" "crc" } } */