| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fdump-tree-crc-details -O2" } */ |
| 3 |
/* { dg-require-effective-target int32plus } */ |
| 4 |
|
| 5 |
// File - cold-flash.i |
| 6 |
#include <stdint.h> |
| 7 |
uint32_t tab[256]; |
| 8 |
|
| 9 |
void crc32_gentab(void) { |
| 10 |
|
| 11 |
int i, j; |
| 12 |
uint32_t crc; |
| 13 |
uint32_t poly = 0xEDB88320L; |
| 14 |
|
| 15 |
for ( i = 0; i < 256; i++) { |
| 16 |
|
| 17 |
crc = i; |
| 18 |
|
| 19 |
for ( j = 8; j > 0; j-- ) { |
| 20 |
|
| 21 |
if ( crc & 1 ) |
| 22 |
crc = (crc >> 1) ^ poly; |
| 23 |
else |
| 24 |
crc >>= 1; |
| 25 |
|
| 26 |
} |
| 27 |
|
| 28 |
tab[i] = crc; |
| 29 |
|
| 30 |
} |
| 31 |
|
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-tree-dump "calculates CRC!" "crc" } } */ |