| 1 |
/* PR tree-optimization/88753 */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-switchconv" } */ |
| 3 |
/* { dg-do run { target nonpic } } */ |
| 4 |
|
| 5 |
typedef unsigned short int uint16_t; |
| 6 |
typedef unsigned char uint8_t; |
| 7 |
|
| 8 |
uint16_t length; |
| 9 |
uint16_t enc_method_global; |
| 10 |
|
| 11 |
uint8_t |
| 12 |
__attribute__((noipa)) |
| 13 |
_zip_buffer_get_8(int buffer) |
| 14 |
{ |
| 15 |
return buffer; |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
__attribute__((noipa)) |
| 20 |
foo(int v) |
| 21 |
{ |
| 22 |
uint16_t enc_method; |
| 23 |
switch (_zip_buffer_get_8(v)) { |
| 24 |
case 1: |
| 25 |
enc_method = 0x0101; |
| 26 |
break; |
| 27 |
case 2: |
| 28 |
enc_method = 0x0102; |
| 29 |
break; |
| 30 |
case 3: |
| 31 |
enc_method = 0x0103; |
| 32 |
break; |
| 33 |
default: |
| 34 |
__builtin_abort (); |
| 35 |
} |
| 36 |
|
| 37 |
enc_method_global = enc_method; |
| 38 |
} |
| 39 |
|
| 40 |
int main(int argc, char **argv) |
| 41 |
{ |
| 42 |
foo (1); |
| 43 |
if (enc_method_global != 0x0101) |
| 44 |
__builtin_abort (); |
| 45 |
|
| 46 |
foo (2); |
| 47 |
if (enc_method_global != 0x0102) |
| 48 |
__builtin_abort (); |
| 49 |
|
| 50 |
foo (3); |
| 51 |
if (enc_method_global != 0x0103) |
| 52 |
__builtin_abort (); |
| 53 |
|
| 54 |
return 0; |
| 55 |
} |
| 56 |
|
| 57 |
/* { dg-final { scan-tree-dump-times "Linear transformation with A = 1 and B = 256" 1 "switchconv" } } */ |