re PR target/47192 (m68k target - gcc uses stack frame after it has been unlinked...
authorJeff Law <law@redhat.com>
Thu, 17 Nov 2016 23:39:08 +0000 (16:39 -0700)
committerJeff Law <law@gcc.gnu.org>
Thu, 17 Nov 2016 23:39:08 +0000 (16:39 -0700)
PR target/47192
* config/m68k/m68k.c (m68k_expand_epilogue): Emit a scheduling
barrier prior to deallocating the stack.

PR target/47192
* gcc.target/m68k/pr47192.c: New test.

From-SVN: r242575

gcc/ChangeLog
gcc/config/m68k/m68k.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/m68k/pr47192.c [new file with mode: 0644]

index 24ed0f89b9e24a660ceba65f4bd0e6d2cb42f184..86a8fdf7d76e28b73b4db5dc789325fe36db0738 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-17  Jeff Law  <law@redhat.com>
+
+       PR target/47192
+       * config/m68k/m68k.c (m68k_expand_epilogue): Emit a scheduling
+       barrier prior to deallocating the stack.
+
 2016-11-17  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * config/arc/arc.md (cmem bit/sign-extend peephole2): New peephole
index ce5669264965ebf82bbc8d1d04e07e648ad6881d..346c2dc6af36c93acc64274e5a8f4950eb153af3 100644 (file)
@@ -1205,6 +1205,7 @@ m68k_expand_epilogue (bool sibcall_p)
             stack-based restore.  */
          emit_move_insn (gen_rtx_REG (Pmode, A1_REG),
                          GEN_INT (-(current_frame.offset + fsize)));
+         emit_insn (gen_blockage ());
          emit_insn (gen_addsi3 (stack_pointer_rtx,
                                 gen_rtx_REG (Pmode, A1_REG),
                                 frame_pointer_rtx));
@@ -1306,6 +1307,7 @@ m68k_expand_epilogue (bool sibcall_p)
                         current_frame.fpu_mask, false, false);
     }
 
+  emit_insn (gen_blockage ());
   if (frame_pointer_needed)
     emit_insn (gen_unlink (frame_pointer_rtx));
   else if (fsize_with_regs)
index 356d75aab4265f40be471826115309b30b366b66..5dd6f569a2299e6257f4cba4b5c79558c1e8ce1d 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-17  Jeff Law  <law@redhat.com>
+
+       PR target/47192
+       * gcc.target/m68k/pr47192.c: New test.
+
 2016-11-17  Toma Tabacu  <toma.tabacu@imgtec.com>
 
        * gcc.target/mips/branch-cost-1.c (dg-options): Use (HAS_MOVN)
diff --git a/gcc/testsuite/gcc.target/m68k/pr47192.c b/gcc/testsuite/gcc.target/m68k/pr47192.c
new file mode 100644 (file)
index 0000000..5bbef58
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcpu=51qe -fdisable-ipa-pure-const -fdump-rtl-pro_and_epilogue" } */
+/* { dg-final { scan-rtl-dump-times "unspec_volatile" 1 "pro_and_epilogue"} } */
+
+
+char F(short *ty);
+
+short V(char cmd)
+{
+  static short st256;
+  static short stc;
+  short sc;
+  short scd;
+  short d;
+
+  F(&sc);
+
+  if (cmd == 4)
+  {
+    st256 = 0;
+    d = 0;
+  }
+  else
+  {
+    scd = sc - stc;
+    if (scd < -128)
+    {
+      scd += 256;
+    }
+    d = st256 >> 8;
+    st256 -= d << 8;
+  }
+  stc = sc;
+  return d;
+}
+