]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[AArch64] Optimize epilogue in the presence of an outgoing args area.
authorJiong Wang <jiong.wang@arm.com>
Thu, 24 Jul 2014 10:58:28 +0000 (10:58 +0000)
committerMarcus Shawcroft <mshawcroft@gcc.gnu.org>
Thu, 24 Jul 2014 10:58:28 +0000 (10:58 +0000)
From-SVN: r212976

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/test_frame_12.c

index cf8dfe92da11e2912247a0c961a0d61498bd0806..b17476401d1604ea22fe01320e61810d2cc8b30f 100644 (file)
@@ -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
index 5da7891e7a000de0c5d255a02d75590f8865ca97..345705185e0ce14db5687840bf9a0b7c79845e61 100644 (file)
@@ -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
        {
index 09ff1dca7d79f7bda4d5c12100ece264c54eeb65..2067bee777727defafcd1aaefcfbcedbd58a1188 100644 (file)
@@ -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
index 36495277dde99bf49f72fa4dc55d56b6cdf18c69..81f00706175e93e4a71658fb48a1a5c409eb5e1d 100644 (file)
@@ -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 } } */