| 1 |
/* { dg-options "-O2 -fdump-rtl-ext_dce" } */ |
| 2 |
typedef unsigned char __uint8_t; |
| 3 |
typedef unsigned int __uint32_t; |
| 4 |
typedef __uint8_t uint8_t; |
| 5 |
typedef __uint32_t uint32_t; |
| 6 |
static inline void |
| 7 |
unaligned_write32le(uint8_t *buf, uint32_t num) |
| 8 |
{ |
| 9 |
buf[0] = num; |
| 10 |
buf[1] = num >> 8; |
| 11 |
buf[2] = num >> 16; |
| 12 |
buf[3] = num >> 24; |
| 13 |
return; |
| 14 |
} |
| 15 |
typedef struct { |
| 16 |
uint32_t dict_size; |
| 17 |
} lzma_options_lzma; |
| 18 |
typedef void lzma_coder; |
| 19 |
typedef struct lzma_next_coder_s lzma_next_coder; |
| 20 |
struct lzma_next_coder_s { |
| 21 |
lzma_coder *coder; |
| 22 |
}; |
| 23 |
struct lzma_coder_s { |
| 24 |
uint8_t header[(1 + 4 + 8)]; |
| 25 |
}; |
| 26 |
|
| 27 |
void |
| 28 |
alone_encoder_init(lzma_next_coder *next, const lzma_options_lzma *options) |
| 29 |
{ |
| 30 |
uint32_t d = options->dict_size - 1; |
| 31 |
d |= d >> 2; |
| 32 |
#if 0 |
| 33 |
d |= d >> 3; |
| 34 |
d |= d >> 4; |
| 35 |
d |= d >> 8; |
| 36 |
d |= d >> 16; |
| 37 |
#endif |
| 38 |
if (d != (4294967295U)) |
| 39 |
++d; |
| 40 |
unaligned_write32le(((struct lzma_coder_s*)next->coder)->header + 1, d); |
| 41 |
} |
| 42 |
|
| 43 |
/* { dg-final { scan-rtl-dump "Successfully transformed to:" "ext_dce" } } */ |
| 44 |
|