From b8fedf996be60ac2de2dcd0dbe39e9f258cf0c8e Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 24 Jul 2015 11:29:50 +0000 Subject: [PATCH] S/390: Fix cfi for GPR 2 FPR saves gcc/ChangeLog: 2015-07-24 Andreas Krebbel * 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-24 Andreas Krebbel * gcc.target/s390/gpr2fprsavecfi.c: New test. From-SVN: r226149 --- gcc/ChangeLog | 5 ++++ gcc/config/s390/s390.c | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/s390/gpr2fprsavecfi.c | 23 +++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/gpr2fprsavecfi.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f375a3a5943..b613180edaf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-07-24 Andreas Krebbel + + * config/s390/s390.c (s390_save_gprs_to_fprs): Add CFA_REGISTER + reg note to the GPR -> FPR save instructions. + 2015-07-24 Andreas Krebbel * config/s390/s390.c (s390_rtx_costs): Make risbg patterns diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index f421e884c66..7f609baba7b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -10132,6 +10132,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/ChangeLog b/gcc/testsuite/ChangeLog index 27278a195d6..72955da88ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-24 Andreas Krebbel + + * gcc.target/s390/gpr2fprsavecfi.c: New test. + 2015-07-24 Andreas Krebbel * gcc.target/s390/insv-1.c: New test. diff --git a/gcc/testsuite/gcc.target/s390/gpr2fprsavecfi.c b/gcc/testsuite/gcc.target/s390/gpr2fprsavecfi.c new file mode 100644 index 00000000000..92a0d3ae29a --- /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" } } */ -- 2.30.2