Skip to content

arc: Fix enter pattern instruction's offsets #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gcc/config/arc/arc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3350,7 +3350,7 @@ arc_save_callee_enter (uint64_t gmask,
reg = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
mem = gen_frame_mem (Pmode, plus_constant (Pmode,
stack_pointer_rtx,
off));
-off));
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, reg);
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx++)) = 1;
off -= UNITS_PER_WORD;
Expand All @@ -3364,7 +3364,7 @@ arc_save_callee_enter (uint64_t gmask,
reg = gen_rtx_REG (SImode, regno);
mem = gen_frame_mem (SImode, plus_constant (Pmode,
stack_pointer_rtx,
off));
-off));
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, reg);
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx)) = 1;
gmask = gmask & ~(1ULL << regno);
Expand All @@ -3374,7 +3374,7 @@ arc_save_callee_enter (uint64_t gmask,
{
mem = gen_frame_mem (Pmode, plus_constant (Pmode,
stack_pointer_rtx,
off));
-off));
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, hard_frame_pointer_rtx);
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx++)) = 1;
off -= UNITS_PER_WORD;
Expand Down
28 changes: 28 additions & 0 deletions gcc/testsuite/gcc.target/arc/enter-dw2-1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* Verify that we generate appropriate CFI offsets in the case of enter
instruction. */
/* { dg-skip-if "Not having enter_s insn." { arc700 || arc6xx } } */
/* { dg-do compile } */
/* { dg-options "-g -Os" } */

extern void bar (void);

void foo (void)
{
asm volatile (";my clobber list"
: : : "r13", "r14", "r15", "r16", "r17", "r18", "r19");
bar ();
asm volatile (";my clobber list"
: : : "r13", "r14", "r15", "r16", "r17", "r18", "r19");
}


/* { dg-final { scan-assembler-times "enter_s" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_def_cfa_offset 32" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 31, -32" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 13, -28" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 14, -24" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 15, -20" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 16, -16" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 17, -12" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 18, -8" 1 } } */
/* { dg-final { scan-assembler-times "\.cfi_offset 19, -4" 1 } } */