| 1 |
/* { dg-do compile { target { stack_save_isr } } } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
/* { dg-final { scan-assembler-not "\trte\t\n\tmov.l\t@r15\\+" } } */ |
| 4 |
|
| 5 |
/* This test checks if the compiler generates a pop instruction |
| 6 |
in the delay slot after rte. For the sh and sh2, the rte |
| 7 |
instruction reads the return pc from the stack and any pop |
| 8 |
in the delay slot crashes the hardware. |
| 9 |
|
| 10 |
Incorrect code generated |
| 11 |
mov.l @r15+,r1 |
| 12 |
rte |
| 13 |
mov.l @r15+,r14 |
| 14 |
|
| 15 |
The right code should be |
| 16 |
|
| 17 |
mov.l @r15+,r1 |
| 18 |
mov.l @r15+,r14 |
| 19 |
rte |
| 20 |
nop |
| 21 |
*/ |
| 22 |
void INT_MTU2_1_TGIA1 (void) |
| 23 |
__attribute__ ((interrupt_handler)); |
| 24 |
void |
| 25 |
INT_MTU2_1_TGIA1 (void) |
| 26 |
{ |
| 27 |
volatile int i = 0; |
| 28 |
volatile int x, y; |
| 29 |
|
| 30 |
for (i = 0; i < 10; i++) |
| 31 |
y = y + x; |
| 32 |
} |