| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fdump-tree-crc-details -O2" } */ |
| 3 |
/* { dg-require-effective-target int32plus } */ |
| 4 |
|
| 5 |
// File - slz |
| 6 |
#include <stdint.h> |
| 7 |
#include <stdio.h> |
| 8 |
uint32_t crc32_fast[4][256]; |
| 9 |
void __slz_make_crc_table(void) { |
| 10 |
uint32_t c; |
| 11 |
int n, k; |
| 12 |
|
| 13 |
for (n = 0; n < 256; n++) { |
| 14 |
c = (uint32_t) n ^ 255; |
| 15 |
for (k = 0; k < 8; k++) { |
| 16 |
if (c & 1) { |
| 17 |
c = 0xedb88320 ^ (c >> 1); |
| 18 |
} else { |
| 19 |
c = c >> 1; |
| 20 |
} |
| 21 |
} |
| 22 |
crc32_fast[0][n] = c ^ 0xff000000; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
int main () |
| 27 |
{ |
| 28 |
__slz_make_crc_table(); |
| 29 |
printf ("%d", crc32_fast[0][0]); |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-tree-dump "calculates CRC!" "crc" } } */ |