From d9fea2c63da99cd8bbb869705f43401bf323a94f Mon Sep 17 00:00:00 2001 From: Dragan Mladjenovic Date: Fri, 17 May 2019 16:28:28 +0000 Subject: [PATCH] mips.c (mips_dwarf_frame_reg_mode): Replace TARGET_FLOAT64 with !TARGET_FLOAT32, thus handling both fp64 and fpxx modes. * config/mips/mips.c (mips_dwarf_frame_reg_mode): Replace TARGET_FLOAT64 with !TARGET_FLOAT32, thus handling both fp64 and fpxx modes. * g++.dg/eh/o32-fp.C: New. * gcc.target/mips/dwarfregtable-1.c: New. * gcc.target/mips/dwarfregtable-2.c: New. * gcc.target/mips/dwarfregtable-3.c: New. * gcc.target/mips/dwarfregtable-4.c: New. * gcc.target/mips/dwarfregtable.h: New. From-SVN: r271331 --- gcc/ChangeLog | 6 +++ gcc/config/mips/mips.c | 2 +- gcc/testsuite/ChangeLog | 9 ++++ gcc/testsuite/g++.dg/eh/o32-fp.C | 47 +++++++++++++++++++ .../gcc.target/mips/dwarfregtable-1.c | 5 ++ .../gcc.target/mips/dwarfregtable-2.c | 5 ++ .../gcc.target/mips/dwarfregtable-3.c | 5 ++ .../gcc.target/mips/dwarfregtable-4.c | 5 ++ gcc/testsuite/gcc.target/mips/dwarfregtable.h | 22 +++++++++ 9 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/o32-fp.C create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-1.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-2.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-3.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable-4.c create mode 100644 gcc/testsuite/gcc.target/mips/dwarfregtable.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b199185527e..d89be8e2172 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-17 Dragan Mladjenovic + + * config/mips/mips.c (mips_dwarf_frame_reg_mode): Replace + TARGET_FLOAT64 with !TARGET_FLOAT32, thus handling both fp64 + and fpxx modes. + 2019-05-17 H.J. Lu PR target/90497 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 4c4c9cb733b..42cafed84ab 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9588,7 +9588,7 @@ mips_dwarf_frame_reg_mode (int regno) { machine_mode mode = default_dwarf_frame_reg_mode (regno); - if (FP_REG_P (regno) && mips_abi == ABI_32 && TARGET_FLOAT64) + if (FP_REG_P (regno) && mips_abi == ABI_32 && !TARGET_FLOAT32) mode = SImode; return mode; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af5de86ae15..a15def5c12c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-05-17 Dragan Mladjenovic + + * g++.dg/eh/o32-fp.C: New. + * gcc.target/mips/dwarfregtable-1.c: New. + * gcc.target/mips/dwarfregtable-2.c: New. + * gcc.target/mips/dwarfregtable-3.c: New. + * gcc.target/mips/dwarfregtable-4.c: New. + * gcc.target/mips/dwarfregtable.h: New. + 2019-05-17 H.J. Lu * gcc.target/x86_64/abi/test_varargs-m128.c: New file. diff --git a/gcc/testsuite/g++.dg/eh/o32-fp.C b/gcc/testsuite/g++.dg/eh/o32-fp.C new file mode 100644 index 00000000000..08fa51bc203 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/o32-fp.C @@ -0,0 +1,47 @@ +// Test whether call saved float are restored properly for O32 ABI +// { dg-do run { target { { { mips*-*-linux* } && hard_float } && { ! mips64 } } } } +// { dg-options "-O2" } + +void __attribute__((noinline)) +bar (void) +{ + throw 1; +} + +void __attribute__((noinline)) +foo (void) +{ + register double f20 __asm__ ("f20") = 0.0; + register double f22 __asm__ ("f22") = 0.0; + register double f24 __asm__ ("f24") = 0.0; + register double f26 __asm__ ("f26") = 0.0; + register double f28 __asm__ ("f28") = 0.0; + register double f30 __asm__ ("f30") = 0.0; + __asm__ __volatile__("":"+f"(f20),"+f"(f22),"+f"(f24),"+f"(f26),"+f"(f30)); + bar (); +} + +int +main (void) +{ + register double f20 __asm__ ("f20") = 12.0; + register double f22 __asm__ ("f22") = 13.0; + register double f24 __asm__ ("f24") = 14.0; + register double f26 __asm__ ("f26") = 15.0; + register double f28 __asm__ ("f28") = 16.0; + register double f30 __asm__ ("f30") = 17.0; + + try + { + foo (); + } + catch (...) + { + __asm__ ("":"+f"(f20),"+f"(f22),"+f"(f24),"+f"(f26),"+f"(f30)); + } + + if (f20 != 12.0 || f22 != 13.0 || f24 != 14.0 + || f26 != 15.0 || f28 != 16.0 || f30 != 17.0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-1.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-1.c new file mode 100644 index 00000000000..93d0844e6e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-1.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfp32" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-2.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-2.c new file mode 100644 index 00000000000..c6dea942a13 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-2.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfpxx" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-3.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-3.c new file mode 100644 index 00000000000..87937c4f0e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-3.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfp64" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable-4.c b/gcc/testsuite/gcc.target/mips/dwarfregtable-4.c new file mode 100644 index 00000000000..2dd6dea3be7 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable-4.c @@ -0,0 +1,5 @@ +/* Check if content of dwarf reg size table matches the expected. */ +/* { dg-do run } */ +/* { dg-options "-mabi=32 -mfp64 -modd-spreg" } */ + +#include "dwarfregtable.h" diff --git a/gcc/testsuite/gcc.target/mips/dwarfregtable.h b/gcc/testsuite/gcc.target/mips/dwarfregtable.h new file mode 100644 index 00000000000..403f65fb7b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/dwarfregtable.h @@ -0,0 +1,22 @@ + +typedef unsigned Unwind_Word __attribute__((__mode__(__unwind_word__))); + +#define DWARF_FRAME_REGISTERS 188 + +static unsigned char ref_dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1] = + { + [0 ... 66] = sizeof (Unwind_Word), + [80 ... 181] = sizeof (Unwind_Word) + }; + +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS + 1] = {}; + +int +main (void) +{ + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); + if (__builtin_memcmp (ref_dwarf_reg_size_table, + dwarf_reg_size_table, DWARF_FRAME_REGISTERS + 1) != 0) + __builtin_abort (); + return 0; +} -- 2.30.2