| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Os" } */ |
| 3 |
|
| 4 |
/* This testcase verifies that a uint8_t variable assigned from a wider variable |
| 5 |
with the same range is held in a single register. VRP must not fold away the |
| 6 |
conversion and use two regs to hold the uint16_t - widenings are ok only upto |
| 7 |
word mode (1 byte for AVR). |
| 8 |
*/ |
| 9 |
|
| 10 |
unsigned int foo(const unsigned int wvalue) |
| 11 |
{ |
| 12 |
const unsigned char type = (wvalue >> 8); |
| 13 |
unsigned int size = 0; |
| 14 |
|
| 15 |
if (type == 1) |
| 16 |
{ |
| 17 |
size = 20; |
| 18 |
} |
| 19 |
return size; |
| 20 |
} |
| 21 |
|
| 22 |
/* { dg-final { scan-assembler "cpi r25,lo8\\(1\\)" } } */ |
| 23 |
/* { dg-final { scan-assembler-not "cpc r\\d+,__zero_reg__" } } */ |
| 24 |
|