| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-switchconv -mbmi" } */ |
| 3 |
|
| 4 |
/* Checks that when exponential index transform is viable but switch conversion |
| 5 |
decides that the switch cannot be converted, the exponential index transform |
| 6 |
is not done. */ |
| 7 |
|
| 8 |
int a; |
| 9 |
|
| 10 |
int foo(unsigned bar) |
| 11 |
{ |
| 12 |
switch (bar) |
| 13 |
{ |
| 14 |
case (1 << 0): |
| 15 |
return 0; |
| 16 |
case (1 << 1): |
| 17 |
return 1; |
| 18 |
case (1 << 2): |
| 19 |
return 2; |
| 20 |
case (1 << 3): |
| 21 |
return 3; |
| 22 |
case (1 << 4): |
| 23 |
return 4; |
| 24 |
case (1 << 5): |
| 25 |
a = 3; |
| 26 |
return 5; |
| 27 |
case (1 << 6): |
| 28 |
return 6; |
| 29 |
default: |
| 30 |
return 0; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-tree-dump "Exponential index transform viable" "switchconv" } } */ |
| 35 |
/* { dg-final { scan-tree-dump-not "Applying exponential index transform" "switchconv" } } */ |