diff options
author | Claudiu Zissulescu <claziss@gmail.com> | 2022-07-18 14:32:41 +0300 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gmail.com> | 2022-07-18 14:36:58 +0300 |
commit | 9c8349ee1a35dac61b84bbae115ee6a1eeb6ddbd (patch) | |
tree | 918e5a2a20d878385e8b5f756e8e73a3c3892322 /gcc | |
parent | ce92603fbe3b4870e0a38efee1ee766d62942065 (diff) | |
download | gcc-9c8349ee1a35dac61b84bbae115ee6a1eeb6ddbd.zip gcc-9c8349ee1a35dac61b84bbae115ee6a1eeb6ddbd.tar.gz gcc-9c8349ee1a35dac61b84bbae115ee6a1eeb6ddbd.tar.bz2 |
arc: Fix interrupt's epilogue.
The stack pointer adjustment in interrupt epilogue is happening after
restoring the ZOL registers which is wrong. Fixing this.
gcc/
* config/arc/arc.cc (arc_expand_epilogue): Adjust the frame
pointer first when in interrupts.
gcc/testsuite/
* gcc.target/arc/interrupt-13.c: New file.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/arc/arc.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arc/interrupt-13.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc index fbc17e6..77730c8 100644 --- a/gcc/config/arc/arc.cc +++ b/gcc/config/arc/arc.cc @@ -3965,7 +3965,7 @@ arc_expand_epilogue (int sibcall_p) if (size) emit_insn (gen_blockage ()); - if (ARC_INTERRUPT_P (fn_type) && restore_fp) + if (ARC_INTERRUPT_P (fn_type)) { /* We need to restore FP before any SP operation in an interrupt. */ diff --git a/gcc/testsuite/gcc.target/arc/interrupt-13.c b/gcc/testsuite/gcc.target/arc/interrupt-13.c new file mode 100644 index 0000000..0ed8451 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/interrupt-13.c @@ -0,0 +1,15 @@ +/* { dg-options "-O2" } */ + +extern int foo (int *); + +void __attribute__((interrupt("ilink"))) +irq (void) +{ + struct { + int x0; + int x1; + } a = {1 ,2}; + foo ((int *)&a); +} + +/* { dg-final { scan-assembler "add_s\\s+sp,sp,8.*pop_s\\s+r0" } } */ |