blob: 2943d85699c41debc320c0cadfbb08ac2bc3e686 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* { dg-do compile } */
/* { dg-options "-fdump-tree-crc" } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
// Modified Coremark test, we don't detect.
#include <stdint.h>
uint16_t not_crcu8 (uint16_t data, uint16_t crc)
{
uint16_t i = 0, carry = 0;
for (i = 0; i < 16; i++)
{
if ((((crc & 1) == 1) && ((data & 1) == 0))
|| (((crc & 1) == 0) && (data & 1) == 1))
{
crc ^= 0x4002;
carry = 1;
}
else
carry = 0;
crc >>= 1;
data >>= 1;
if (carry)
crc |= 0x8000;
else
crc &= 0x7fff;
}
return crc;
}
|