| 1 |
/* { dg-options "-msave-restore" } */ |
| 2 |
/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" } } */ |
| 3 |
|
| 4 |
/* With -msave-restore in use it should not be possible to remove the calls |
| 5 |
to the save and restore stubs in this case (in current GCC). */ |
| 6 |
|
| 7 |
enum |
| 8 |
{ |
| 9 |
VAL_A, |
| 10 |
VAL_B, |
| 11 |
VAL_C, |
| 12 |
VAL_D |
| 13 |
} a; |
| 14 |
|
| 15 |
extern void other_1 (); |
| 16 |
extern void other_2 (); |
| 17 |
|
| 18 |
void func () |
| 19 |
{ |
| 20 |
switch (a) |
| 21 |
{ |
| 22 |
case VAL_B: |
| 23 |
case VAL_C: |
| 24 |
other_1 (); |
| 25 |
case VAL_D: |
| 26 |
other_2 (); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-assembler "call\[ \t\]*t0,__riscv_save_0" } } */ |
| 31 |
/* { dg-final { scan-assembler "tail\[ \t\]*__riscv_restore_0" } } */ |