aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2014-07-24 10:58:28 +0000
committerMarcus Shawcroft <mshawcroft@gcc.gnu.org>2014-07-24 10:58:28 +0000
commit8f454e9f8a19248cbbe33c039934494d67c1feaa (patch)
treee63f97d5d8d7c00ad8267827ed6c77d52fe38dc0 /gcc
parent8ae9698d085b4607da89b9fe193806cc15794510 (diff)
downloadgcc-8f454e9f8a19248cbbe33c039934494d67c1feaa.zip
gcc-8f454e9f8a19248cbbe33c039934494d67c1feaa.tar.gz
gcc-8f454e9f8a19248cbbe33c039934494d67c1feaa.tar.bz2
[AArch64] Optimize epilogue in the presence of an outgoing args area.
From-SVN: r212976
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/aarch64/aarch64.c24
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/test_frame_12.c4
4 files changed, 21 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cf8dfe9..b174764 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-24 Jiong Wang <jiong.wang@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_expand_epilogue): Don't
+ subtract outgoing area size when restoring stack_pointer_rtx.
+
2014-07-24 Nick Clifton <nickc@redhat.com>
* config/rx/rx.md (stack_push): Adjust RTL to account for the fact
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5da7891..3457051 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2363,7 +2363,8 @@ aarch64_expand_epilogue (bool for_sibcall)
{
insn = emit_insn (gen_add3_insn (stack_pointer_rtx,
hard_frame_pointer_rtx,
- GEN_INT (- fp_offset)));
+ GEN_INT (0)));
+ offset = offset - fp_offset;
RTX_FRAME_RELATED_P (insn) = 1;
/* As SP is set to (FP - fp_offset), according to the rules in
dwarf2cfi.c:dwarf2out_frame_debug_expr, CFA should be calculated
@@ -2371,27 +2372,16 @@ aarch64_expand_epilogue (bool for_sibcall)
cfa_reg = stack_pointer_rtx;
}
- aarch64_restore_callee_saves (DFmode, fp_offset, V0_REGNUM, V31_REGNUM);
+ aarch64_restore_callee_saves (DFmode, frame_pointer_needed ? 0 : fp_offset,
+ V0_REGNUM, V31_REGNUM);
if (offset > 0)
{
if (frame_pointer_needed)
{
- if (fp_offset)
- {
- aarch64_restore_callee_saves (DImode, fp_offset, R0_REGNUM,
- R30_REGNUM);
- insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
- GEN_INT (offset)));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- {
- aarch64_restore_callee_saves (DImode, fp_offset, R0_REGNUM,
- R28_REGNUM);
- aarch64_popwb_pair_reg (DImode, R29_REGNUM, R30_REGNUM, offset,
- cfa_reg);
- }
+ aarch64_restore_callee_saves (DImode, 0, R0_REGNUM, R28_REGNUM);
+ aarch64_popwb_pair_reg (DImode, R29_REGNUM, R30_REGNUM, offset,
+ cfa_reg);
}
else
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 09ff1dc..2067bee 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-24 Jiong Wang <jiong.wang@arm.com>
+
+ * gcc.target/aarch64/test_frame_12.c: Match optimized instruction
+ sequences.
+
2014-07-24 Marek Polacek <polacek@redhat.com>
PR c/57653
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_12.c b/gcc/testsuite/gcc.target/aarch64/test_frame_12.c
index 3649527..81f0070 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_12.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_12.c
@@ -12,4 +12,8 @@ t_frame_pattern_outgoing (test12, 400, , 8, a[8])
t_frame_run (test12)
/* { dg-final { scan-assembler-times "sub\tsp, sp, #\[0-9\]+" 1 } } */
+
+/* Check epilogue using write-back. */
+/* { dg-final { scan-assembler-times "ldp\tx29, x30, \\\[sp\\\], \[0-9\]+" 3 } } */
+
/* { dg-final { cleanup-saved-temps } } */