public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] S/390: Fix cfi for GPR 2 FPR saves
@ 2015-07-22 14:12 Andreas Krebbel
  0 siblings, 0 replies; only message in thread
From: Andreas Krebbel @ 2015-07-22 14:12 UTC (permalink / raw)
  To: gcc-patches

Hi,

GCC currently does not emit register save cfi information for the
stack pointer register.  Instead dwarf2cfi considers the load into an
FPR as using a new CFA register from now on.

Adding a CFA_REGISTER note prevent dwarf2cfi from interpreting the
insn itself.

This fixes the Glibc testcases tst-cancelx4 and tst-cancelx5.

I'll commit the patch after waiting a few days for review comments.

Bootstrapped on s390x. No regressions.

Bye,

-Andreas-

gcc/ChangeLog:

2015-07-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/s390/s390.c (s390_save_gprs_to_fprs): Add CFA_REGISTER
	reg note to the GPR -> FPR save instructions.

gcc/testsuite/ChangeLog:

2015-07-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* gcc.target/s390/gpr2fprsavecfi.c: New test.


diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index faf7621..a31f33c 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -10134,6 +10134,10 @@ s390_save_gprs_to_fprs (void)
 	    emit_move_insn (gen_rtx_REG (DImode, cfun_gpr_save_slot (i)),
 			    gen_rtx_REG (DImode, i));
 	  RTX_FRAME_RELATED_P (insn) = 1;
+	  /* This prevents dwarf2cfi from interpreting the set.  Doing
+	     so it might emit def_cfa_register infos setting an FPR as
+	     new CFA.  */
+	  add_reg_note (insn, REG_CFA_REGISTER, PATTERN (insn));
 	}
     }
 }
diff --git a/gcc/testsuite/gcc.target/s390/gpr2fprsavecfi.c b/gcc/testsuite/gcc.target/s390/gpr2fprsavecfi.c
new file mode 100644
index 0000000..92a0d3a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/gpr2fprsavecfi.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 -mzarch -fdwarf2-cfi-asm" } */
+
+char *gl[100];
+
+long
+foo ()
+{
+  long r = 0;
+  char bla[100];
+  int i;
+
+  __builtin_memcpy (bla, gl, 100);
+
+  for (i = 0; i < 100; i++)
+    r += bla[i];
+
+  return r;
+}
+
+/* { dg-final { scan-assembler-not "cfi_def_cfa_register" } } */
+/* { dg-final { scan-assembler "cfi_register" } } */
+/* { dg-final { scan-assembler "cfi_def_cfa_offset" } } */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-22 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-22 14:12 [PATCH] S/390: Fix cfi for GPR 2 FPR saves Andreas Krebbel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).