From 7e5c37460676745c3ab8b92e4d08d5a702eb06b1 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Thu, 6 Aug 2015 10:23:38 +0000 Subject: [PATCH] S/390: Fix dwarf reg size table for -m31 -mzarch. gcc/ChangeLog: * config/s390/s390.c (s390_dwarf_frame_reg_mode): Return Pmode for all GPRs. gcc/testsuite/ChangeLog: * gcc.target/s390/dwarfregtable-1.c: New test. * gcc.target/s390/dwarfregtable-2.c: New test. * gcc.target/s390/dwarfregtable-3.c: New test. From-SVN: r226673 --- gcc/ChangeLog | 5 +++++ gcc/config/s390/s390.c | 4 ++++ gcc/testsuite/ChangeLog | 6 ++++++ .../gcc.target/s390/dwarfregtable-1.c | 21 +++++++++++++++++++ .../gcc.target/s390/dwarfregtable-2.c | 21 +++++++++++++++++++ .../gcc.target/s390/dwarfregtable-3.c | 20 ++++++++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/dwarfregtable-1.c create mode 100644 gcc/testsuite/gcc.target/s390/dwarfregtable-2.c create mode 100644 gcc/testsuite/gcc.target/s390/dwarfregtable-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 357ea67b76e..aab022cb722 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-08-06 Andreas Krebbel + + * config/s390/s390.c (s390_dwarf_frame_reg_mode): Return Pmode for + all GPRs. + 2015-08-06 Andreas Krebbel * config/s390/s390.c (s390_expand_tbegin): Expand either diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 24a92908556..5814694adbc 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6497,6 +6497,10 @@ s390_dwarf_frame_reg_mode (int regno) { machine_mode save_mode = default_dwarf_frame_reg_mode (regno); + /* Make sure not to return DImode for any GPR with -m31 -mzarch. */ + if (GENERAL_REGNO_P (regno)) + save_mode = Pmode; + /* The rightmost 64 bits of vector registers are call-clobbered. */ if (GET_MODE_SIZE (save_mode) > 8) save_mode = DImode; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e087538b332..74bbd272d7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-08-06 Andreas Krebbel + + * gcc.target/s390/dwarfregtable-1.c: New test. + * gcc.target/s390/dwarfregtable-2.c: New test. + * gcc.target/s390/dwarfregtable-3.c: New test. + 2015-08-06 Andreas Krebbel * gcc.target/s390/htm-builtins-z13-1.c: New test. diff --git a/gcc/testsuite/gcc.target/s390/dwarfregtable-1.c b/gcc/testsuite/gcc.target/s390/dwarfregtable-1.c new file mode 100644 index 00000000000..b1254987451 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/dwarfregtable-1.c @@ -0,0 +1,21 @@ +/* Make sure the dwarf reg size table doesn't change for 31 bit. */ + +/* { dg-do compile { target { ! lp64 } } } */ +/* { dg-options "-mesa" } */ + +#define DWARF_FRAME_REGISTERS 34 + +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1]; +static unsigned char ref_reg_size_table[DWARF_FRAME_REGISTERS + 1] = + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 0 }; + +int +main () +{ + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); + if (__builtin_memcmp (ref_reg_size_table, + dwarf_reg_size_table, DWARF_FRAME_REGISTERS + 1) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/dwarfregtable-2.c b/gcc/testsuite/gcc.target/s390/dwarfregtable-2.c new file mode 100644 index 00000000000..bc5a9f8e6d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/dwarfregtable-2.c @@ -0,0 +1,21 @@ +/* Make sure the dwarf reg size table doesn't change for 31 bit zarch. */ + +/* { dg-do compile { target { ! lp64 } } } */ +/* { dg-options "-mzarch" } */ + +#define DWARF_FRAME_REGISTERS 34 + +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1]; +static unsigned char ref_reg_size_table[DWARF_FRAME_REGISTERS + 1] = + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 0 }; + +int +main () +{ + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); + if (__builtin_memcmp (ref_reg_size_table, + dwarf_reg_size_table, DWARF_FRAME_REGISTERS + 1) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/dwarfregtable-3.c b/gcc/testsuite/gcc.target/s390/dwarfregtable-3.c new file mode 100644 index 00000000000..55711bf71e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/dwarfregtable-3.c @@ -0,0 +1,20 @@ +/* Make sure the dwarf reg size table doesn't change for 64 bit. */ + +/* { dg-do compile { target { lp64 } } } */ + +#define DWARF_FRAME_REGISTERS 34 + +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1]; +static unsigned char ref_reg_size_table[DWARF_FRAME_REGISTERS + 1] = + { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 0 }; + +int +main () +{ + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); + if (__builtin_memcmp (ref_reg_size_table, + dwarf_reg_size_table, DWARF_FRAME_REGISTERS + 1) != 0) + __builtin_abort (); + return 0; +} -- 2.30.2