Debian Codegraph @

gcc/testsuite/gcc.dg/crc-not-crc-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc -O2" } */
3
4 typedef unsigned short ee_u16;
5 typedef unsigned char ee_u8;
6
7 //loop iteration number is 5
8 ee_u16 not_crcu8 (ee_u8 data, ee_u16 crc) {
9 ee_u8 i = 0, x16 = 0, carry = 0;
10 for (i = 0; i < 5; i++) {
11 x16 = (ee_u8) ((data & 1) ^ ((ee_u8) crc & 1));
12 data >>= 1;
13 if (x16 == 1) {
14 crc ^= 0x4002;
15 carry = 1;
16 } else
17 carry = 0;
18 crc >>= 1;
19 if (carry)
20 crc |= 0x8000;
21 else
22 crc &= 0x7fff;
23 }
24 return crc;
25 }
26 /* { dg-final { scan-tree-dump-times "crcu8 function maybe contains CRC calculation" 0 "crc" } } */
27