public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] gdb: rename floatformats_ia64_quad and fix failed testcases
@ 2022-03-08 12:00 Tiezhu Yang
  2022-03-08 12:00 ` [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad Tiezhu Yang
  2022-03-08 12:00 ` [PATCH 2/2] gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp Tiezhu Yang
  0 siblings, 2 replies; 6+ messages in thread
From: Tiezhu Yang @ 2022-03-08 12:00 UTC (permalink / raw)
  To: gdb-patches

Tiezhu Yang (2):
  gdb: rename floatformats_ia64_quad to floatformats_ieee_quad
  gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp

 gdb/aarch64-tdep.c      |  2 +-
 gdb/gdbtypes.c          |  8 ++++----
 gdb/gdbtypes.h          |  2 +-
 gdb/hppa-tdep.c         |  2 +-
 gdb/i386-tdep.c         |  2 +-
 gdb/ia64-vms-tdep.c     |  2 +-
 gdb/loongarch-tdep.c    |  4 ++++
 gdb/mips-linux-tdep.c   | 12 ++----------
 gdb/mips64-obsd-tdep.c  |  6 +-----
 gdb/ppc-linux-tdep.c    |  4 ++--
 gdb/riscv-tdep.c        |  2 +-
 gdb/rs6000-tdep.c       |  2 +-
 gdb/s390-tdep.c         |  2 +-
 gdb/sparc-tdep.c        |  6 +-----
 include/floatformat.h   |  6 +++---
 libiberty/floatformat.c | 34 +++++++++++++++++-----------------
 16 files changed, 42 insertions(+), 54 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad
  2022-03-08 12:00 [PATCH 0/2] gdb: rename floatformats_ia64_quad and fix failed testcases Tiezhu Yang
@ 2022-03-08 12:00 ` Tiezhu Yang
  2022-03-09 14:24   ` Luis Machado
  2022-03-11 14:49   ` Tom Tromey
  2022-03-08 12:00 ` [PATCH 2/2] gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp Tiezhu Yang
  1 sibling, 2 replies; 6+ messages in thread
From: Tiezhu Yang @ 2022-03-08 12:00 UTC (permalink / raw)
  To: gdb-patches

It is better to rename floatformats_ia64_quad to floatformats_ieee_quad
to reflect the reality, and then we can clean up the related code.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 gdb/aarch64-tdep.c      |  2 +-
 gdb/gdbtypes.c          |  8 ++++----
 gdb/gdbtypes.h          |  2 +-
 gdb/hppa-tdep.c         |  2 +-
 gdb/i386-tdep.c         |  2 +-
 gdb/ia64-vms-tdep.c     |  2 +-
 gdb/mips-linux-tdep.c   | 12 ++----------
 gdb/mips64-obsd-tdep.c  |  6 +-----
 gdb/ppc-linux-tdep.c    |  4 ++--
 gdb/riscv-tdep.c        |  2 +-
 gdb/rs6000-tdep.c       |  2 +-
 gdb/s390-tdep.c         |  2 +-
 gdb/sparc-tdep.c        |  6 +-----
 include/floatformat.h   |  6 +++---
 libiberty/floatformat.c | 34 +++++++++++++++++-----------------
 15 files changed, 38 insertions(+), 54 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index b3efb3e..45b592d 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3582,7 +3582,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_wchar_signed (gdbarch, 0);
   set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
   set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
-  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
   set_gdbarch_type_align (gdbarch, aarch64_type_align);
 
   /* Internal <-> external register number maps.  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index f41d6bd..1f8a9e8 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -85,6 +85,10 @@ const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN] = {
   &floatformat_ieee_double_big,
   &floatformat_ieee_double_little
 };
+const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_ieee_quad_big,
+  &floatformat_ieee_quad_little
+};
 const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN] = {
   &floatformat_ieee_double_big,
   &floatformat_ieee_double_littlebyte_bigword
@@ -105,10 +109,6 @@ const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN] = {
   &floatformat_ia64_spill_big,
   &floatformat_ia64_spill_little
 };
-const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN] = {
-  &floatformat_ia64_quad_big,
-  &floatformat_ia64_quad_little
-};
 const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN] = {
   &floatformat_vax_f,
   &floatformat_vax_f
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index bd192da..2578b77 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2401,12 +2401,12 @@ extern const struct objfile_type *objfile_type (struct objfile *objfile);
 extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index cf84555..a7d227d 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -3072,7 +3072,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      and LP64, but might show differences some day.  */
   set_gdbarch_long_long_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 
   /* The following gdbarch vector elements do not depend on the address
      size, or in any other gdbarch element previously set.  */
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index b98f475..b0a5973 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8243,7 +8243,7 @@ i386_floatformat_for_type (struct gdbarch *gdbarch,
 	|| strcmp (name, "real(kind=16)") == 0
 	|| strcmp (name, "real*16") == 0
 	|| strcmp (name, "REAL*16") == 0)
-      return floatformats_ia64_quad;
+      return floatformats_ieee_quad;
 
   return default_floatformat_for_type (gdbarch, name, len);
 }
diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
index 23f3265..9b12df4 100644
--- a/gdb/ia64-vms-tdep.c
+++ b/gdb/ia64-vms-tdep.c
@@ -132,7 +132,7 @@ static struct libunwind_descr ia64_vms_libunwind_descr;
 static void
 ia64_openvms_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 
 #ifdef HAVE_LIBUNWIND_IA64_H
   /* Override the default descriptor.  */
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 6686355..3f4c1b3 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -1556,11 +1556,7 @@ mips_linux_init_abi (struct gdbarch_info info,
 	set_solib_svr4_fetch_link_map_offsets
 	  (gdbarch, linux_ilp32_fetch_link_map_offsets);
 	set_gdbarch_long_double_bit (gdbarch, 128);
-	/* These floatformats should probably be renamed.  MIPS uses
-	   the same 128-bit IEEE floating point format that IA-64 uses,
-	   except that the quiet/signalling NaN bit is reversed (GDB
-	   does not distinguish between quiet and signalling NaNs).  */
-	set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+	set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 	tramp_frame_prepend_unwinder (gdbarch,
 				      &micromips_linux_n32_rt_sigframe);
 	tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
@@ -1572,11 +1568,7 @@ mips_linux_init_abi (struct gdbarch_info info,
 	set_solib_svr4_fetch_link_map_offsets
 	  (gdbarch, linux_lp64_fetch_link_map_offsets);
 	set_gdbarch_long_double_bit (gdbarch, 128);
-	/* These floatformats should probably be renamed.  MIPS uses
-	   the same 128-bit IEEE floating point format that IA-64 uses,
-	   except that the quiet/signalling NaN bit is reversed (GDB
-	   does not distinguish between quiet and signalling NaNs).  */
-	set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+	set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 	tramp_frame_prepend_unwinder (gdbarch,
 				      &micromips_linux_n64_rt_sigframe);
 	tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
diff --git a/gdb/mips64-obsd-tdep.c b/gdb/mips64-obsd-tdep.c
index 0e63d16..8fe2834 100644
--- a/gdb/mips64-obsd-tdep.c
+++ b/gdb/mips64-obsd-tdep.c
@@ -29,10 +29,6 @@
 #include "mips-tdep.h"
 #include "solib-svr4.h"
 
-/* The MIPS64 Floating-Point Quad-Precision format is similar to
-   big-endian IA-64 Quad-Precision format.  */
-#define floatformats_mips64_quad floatformats_ia64_quad
-
 #define MIPS64OBSD_NUM_REGS 73
 
 /* Core file support.  */
@@ -150,7 +146,7 @@ mips64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   tramp_frame_prepend_unwinder (gdbarch, &mips64obsd_sigframe);
 
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, floatformats_mips64_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 
   obsd_init_abi(info, gdbarch);
 
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 0b165fe..63cffbd 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1974,7 +1974,7 @@ ppc_floatformat_for_type (struct gdbarch *gdbarch,
 	  || strcmp (name, "_Float64x") == 0
 	  || strcmp (name, "complex _Float128") == 0
 	  || strcmp (name, "complex _Float64x") == 0)
-	return floatformats_ia64_quad;
+	return floatformats_ieee_quad;
 
       if (strcmp (name, "__ibm128") == 0)
 	return floatformats_ibm_long_double;
@@ -2053,7 +2053,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
      to distinguish between the IBM long double and IEEE quad cases.  */
   set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
   if (tdep->long_double_abi == POWERPC_LONG_DOUBLE_IEEE128)
-    set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+    set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
   else
     set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
 
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 886996c..036577d 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -3769,7 +3769,7 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_float_bit (gdbarch, 32);
   set_gdbarch_double_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
   set_gdbarch_ptr_bit (gdbarch, riscv_isa_xlen (gdbarch) * 8);
   set_gdbarch_char_signed (gdbarch, 0);
   set_gdbarch_type_align (gdbarch, riscv_type_align);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index ee3f051..7016ed3 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2434,7 +2434,7 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
 
       /* PPC specific type for IEEE 128-bit float field */
       struct type *t_float128
-	= arch_float_type (gdbarch, 128, "float128_t", floatformats_ia64_quad);
+	= arch_float_type (gdbarch, 128, "float128_t", floatformats_ieee_quad);
 
       struct type *t;
 
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 153f0ed..cf53c6d 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -7038,7 +7038,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      We can safely let them default to 128-bit, since the debug info
      will give the size of type actually used in each case.  */
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 
   set_gdbarch_type_align (gdbarch, s390_type_align);
 
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 03242ed..1d90bb1 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -61,10 +61,6 @@ struct regset;
    code that can handle both.  The 64-bit specific code lives in
    sparc64-tdep.c; don't add any here.  */
 
-/* The SPARC Floating-Point Quad-Precision format is similar to
-   big-endian IA-64 Quad-Precision format.  */
-#define floatformats_sparc_quad floatformats_ia64_quad
-
 /* The stack pointer is offset from the stack frame by a BIAS of 2047
    (0x7ff) for 64-bit code.  BIAS is likely to be defined on SPARC
    hosts, so undefine it first.  */
@@ -1838,7 +1834,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep->cp0_registers_num = ARRAY_SIZE (sparc32_cp0_register_names);
 
   set_gdbarch_long_double_bit (gdbarch, 128);
-  set_gdbarch_long_double_format (gdbarch, floatformats_sparc_quad);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
 
   set_gdbarch_wchar_bit (gdbarch, 16);
   set_gdbarch_wchar_signed (gdbarch, 1);
diff --git a/include/floatformat.h b/include/floatformat.h
index c851879..ffb02f9 100644
--- a/include/floatformat.h
+++ b/include/floatformat.h
@@ -97,7 +97,7 @@ struct floatformat
   const struct floatformat *split_half;
 };
 
-/* floatformats for IEEE single and double, big and little endian.  */
+/* floatformats for IEEE half, single, double and quad, big and little endian.  */
 
 extern const struct floatformat floatformat_ieee_half_big;
 extern const struct floatformat floatformat_ieee_half_little;
@@ -105,6 +105,8 @@ extern const struct floatformat floatformat_ieee_single_big;
 extern const struct floatformat floatformat_ieee_single_little;
 extern const struct floatformat floatformat_ieee_double_big;
 extern const struct floatformat floatformat_ieee_double_little;
+extern const struct floatformat floatformat_ieee_quad_big;
+extern const struct floatformat floatformat_ieee_quad_little;
 
 /* floatformat for ARM IEEE double, little endian bytes and big endian words */
 
@@ -128,8 +130,6 @@ extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
 /* IA-64 Floating Point register spilt into memory.  */
 extern const struct floatformat floatformat_ia64_spill_big;
 extern const struct floatformat floatformat_ia64_spill_little;
-extern const struct floatformat floatformat_ia64_quad_big;
-extern const struct floatformat floatformat_ia64_quad_little;
 /* IBM long double (double+double).  */
 extern const struct floatformat floatformat_ibm_long_double_big;
 extern const struct floatformat floatformat_ibm_long_double_little;
diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
index ce36bae..f93568b 100644
--- a/libiberty/floatformat.c
+++ b/libiberty/floatformat.c
@@ -78,7 +78,7 @@ floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
    a system header, what we do if not, etc.  */
 #define FLOATFORMAT_CHAR_BIT 8
 
-/* floatformats for IEEE half, single and double, big and little endian.  */
+/* floatformats for IEEE half, single, double and quad, big and little endian.  */
 const struct floatformat floatformat_ieee_half_big =
 {
   floatformat_big, 16, 0, 1, 5, 15, 31, 6, 10,
@@ -127,6 +127,22 @@ const struct floatformat floatformat_ieee_double_little =
   floatformat_always_valid,
   NULL
 };
+const struct floatformat floatformat_ieee_quad_big =
+{
+  floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
+  floatformat_intbit_no,
+  "floatformat_ieee_quad_big",
+  floatformat_always_valid,
+  NULL
+};
+const struct floatformat floatformat_ieee_quad_little =
+{
+  floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
+  floatformat_intbit_no,
+  "floatformat_ieee_quad_little",
+  floatformat_always_valid,
+  NULL
+};
 
 /* floatformat for IEEE double, little endian byte order, with big endian word
    ordering, as on the ARM.  */
@@ -269,22 +285,6 @@ const struct floatformat floatformat_ia64_spill_little =
   floatformat_always_valid,
   NULL
 };
-const struct floatformat floatformat_ia64_quad_big =
-{
-  floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
-  floatformat_intbit_no,
-  "floatformat_ia64_quad_big",
-  floatformat_always_valid,
-  NULL
-};
-const struct floatformat floatformat_ia64_quad_little =
-{
-  floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
-  floatformat_intbit_no,
-  "floatformat_ia64_quad_little",
-  floatformat_always_valid,
-  NULL
-};
 
 static int
 floatformat_ibm_long_double_is_valid (const struct floatformat *fmt,
-- 
2.1.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp
  2022-03-08 12:00 [PATCH 0/2] gdb: rename floatformats_ia64_quad and fix failed testcases Tiezhu Yang
  2022-03-08 12:00 ` [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad Tiezhu Yang
@ 2022-03-08 12:00 ` Tiezhu Yang
  2022-03-11 14:51   ` Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: Tiezhu Yang @ 2022-03-08 12:00 UTC (permalink / raw)
  To: gdb-patches

When execute the following command on LoongArch:

  make check-gdb TESTS="gdb.base/align-c.exp"

there exists some failed testcases:

  ...
  FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_float)
  FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_double)
  FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_long_double)
  ...

According to LoongArch ELF ABI specification [1], set the target data types
of floating-point to fix the above failed testcases.

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 gdb/loongarch-tdep.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index ffcff03..88a8382 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -268,6 +268,10 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_int_bit (gdbarch, 32);
   set_gdbarch_long_bit (gdbarch, info.bfd_arch_info->bits_per_address);
   set_gdbarch_long_long_bit (gdbarch, 64);
+  set_gdbarch_float_bit (gdbarch, 32);
+  set_gdbarch_double_bit (gdbarch, 64);
+  set_gdbarch_long_double_bit (gdbarch, 128);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
   set_gdbarch_ptr_bit (gdbarch, info.bfd_arch_info->bits_per_address);
   set_gdbarch_char_signed (gdbarch, 0);
 
-- 
2.1.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad
  2022-03-08 12:00 ` [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad Tiezhu Yang
@ 2022-03-09 14:24   ` Luis Machado
  2022-03-11 14:49   ` Tom Tromey
  1 sibling, 0 replies; 6+ messages in thread
From: Luis Machado @ 2022-03-09 14:24 UTC (permalink / raw)
  To: Tiezhu Yang, gdb-patches

Hi,

This patch looks OK to me from Arm's backends side.

On 3/8/22 12:00, Tiezhu Yang wrote:
> It is better to rename floatformats_ia64_quad to floatformats_ieee_quad
> to reflect the reality, and then we can clean up the related code.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>   gdb/aarch64-tdep.c      |  2 +-
>   gdb/gdbtypes.c          |  8 ++++----
>   gdb/gdbtypes.h          |  2 +-
>   gdb/hppa-tdep.c         |  2 +-
>   gdb/i386-tdep.c         |  2 +-
>   gdb/ia64-vms-tdep.c     |  2 +-
>   gdb/mips-linux-tdep.c   | 12 ++----------
>   gdb/mips64-obsd-tdep.c  |  6 +-----
>   gdb/ppc-linux-tdep.c    |  4 ++--
>   gdb/riscv-tdep.c        |  2 +-
>   gdb/rs6000-tdep.c       |  2 +-
>   gdb/s390-tdep.c         |  2 +-
>   gdb/sparc-tdep.c        |  6 +-----
>   include/floatformat.h   |  6 +++---
>   libiberty/floatformat.c | 34 +++++++++++++++++-----------------
>   15 files changed, 38 insertions(+), 54 deletions(-)
> 
> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
> index b3efb3e..45b592d 100644
> --- a/gdb/aarch64-tdep.c
> +++ b/gdb/aarch64-tdep.c
> @@ -3582,7 +3582,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>     set_gdbarch_wchar_signed (gdbarch, 0);
>     set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
>     set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
> -  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>     set_gdbarch_type_align (gdbarch, aarch64_type_align);
>   
>     /* Internal <-> external register number maps.  */
> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index f41d6bd..1f8a9e8 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -85,6 +85,10 @@ const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN] = {
>     &floatformat_ieee_double_big,
>     &floatformat_ieee_double_little
>   };
> +const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN] = {
> +  &floatformat_ieee_quad_big,
> +  &floatformat_ieee_quad_little
> +};
>   const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN] = {
>     &floatformat_ieee_double_big,
>     &floatformat_ieee_double_littlebyte_bigword
> @@ -105,10 +109,6 @@ const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN] = {
>     &floatformat_ia64_spill_big,
>     &floatformat_ia64_spill_little
>   };
> -const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN] = {
> -  &floatformat_ia64_quad_big,
> -  &floatformat_ia64_quad_little
> -};
>   const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN] = {
>     &floatformat_vax_f,
>     &floatformat_vax_f
> diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
> index bd192da..2578b77 100644
> --- a/gdb/gdbtypes.h
> +++ b/gdb/gdbtypes.h
> @@ -2401,12 +2401,12 @@ extern const struct objfile_type *objfile_type (struct objfile *objfile);
>   extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
> +extern const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
> -extern const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
>   extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
> diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
> index cf84555..a7d227d 100644
> --- a/gdb/hppa-tdep.c
> +++ b/gdb/hppa-tdep.c
> @@ -3072,7 +3072,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>        and LP64, but might show differences some day.  */
>     set_gdbarch_long_long_bit (gdbarch, 64);
>     set_gdbarch_long_double_bit (gdbarch, 128);
> -  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   
>     /* The following gdbarch vector elements do not depend on the address
>        size, or in any other gdbarch element previously set.  */
> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> index b98f475..b0a5973 100644
> --- a/gdb/i386-tdep.c
> +++ b/gdb/i386-tdep.c
> @@ -8243,7 +8243,7 @@ i386_floatformat_for_type (struct gdbarch *gdbarch,
>   	|| strcmp (name, "real(kind=16)") == 0
>   	|| strcmp (name, "real*16") == 0
>   	|| strcmp (name, "REAL*16") == 0)
> -      return floatformats_ia64_quad;
> +      return floatformats_ieee_quad;
>   
>     return default_floatformat_for_type (gdbarch, name, len);
>   }
> diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
> index 23f3265..9b12df4 100644
> --- a/gdb/ia64-vms-tdep.c
> +++ b/gdb/ia64-vms-tdep.c
> @@ -132,7 +132,7 @@ static struct libunwind_descr ia64_vms_libunwind_descr;
>   static void
>   ia64_openvms_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
>   {
> -  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   
>   #ifdef HAVE_LIBUNWIND_IA64_H
>     /* Override the default descriptor.  */
> diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
> index 6686355..3f4c1b3 100644
> --- a/gdb/mips-linux-tdep.c
> +++ b/gdb/mips-linux-tdep.c
> @@ -1556,11 +1556,7 @@ mips_linux_init_abi (struct gdbarch_info info,
>   	set_solib_svr4_fetch_link_map_offsets
>   	  (gdbarch, linux_ilp32_fetch_link_map_offsets);
>   	set_gdbarch_long_double_bit (gdbarch, 128);
> -	/* These floatformats should probably be renamed.  MIPS uses
> -	   the same 128-bit IEEE floating point format that IA-64 uses,
> -	   except that the quiet/signalling NaN bit is reversed (GDB
> -	   does not distinguish between quiet and signalling NaNs).  */
> -	set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +	set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   	tramp_frame_prepend_unwinder (gdbarch,
>   				      &micromips_linux_n32_rt_sigframe);
>   	tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
> @@ -1572,11 +1568,7 @@ mips_linux_init_abi (struct gdbarch_info info,
>   	set_solib_svr4_fetch_link_map_offsets
>   	  (gdbarch, linux_lp64_fetch_link_map_offsets);
>   	set_gdbarch_long_double_bit (gdbarch, 128);
> -	/* These floatformats should probably be renamed.  MIPS uses
> -	   the same 128-bit IEEE floating point format that IA-64 uses,
> -	   except that the quiet/signalling NaN bit is reversed (GDB
> -	   does not distinguish between quiet and signalling NaNs).  */
> -	set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +	set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   	tramp_frame_prepend_unwinder (gdbarch,
>   				      &micromips_linux_n64_rt_sigframe);
>   	tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
> diff --git a/gdb/mips64-obsd-tdep.c b/gdb/mips64-obsd-tdep.c
> index 0e63d16..8fe2834 100644
> --- a/gdb/mips64-obsd-tdep.c
> +++ b/gdb/mips64-obsd-tdep.c
> @@ -29,10 +29,6 @@
>   #include "mips-tdep.h"
>   #include "solib-svr4.h"
>   
> -/* The MIPS64 Floating-Point Quad-Precision format is similar to
> -   big-endian IA-64 Quad-Precision format.  */
> -#define floatformats_mips64_quad floatformats_ia64_quad
> -
>   #define MIPS64OBSD_NUM_REGS 73
>   
>   /* Core file support.  */
> @@ -150,7 +146,7 @@ mips64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
>     tramp_frame_prepend_unwinder (gdbarch, &mips64obsd_sigframe);
>   
>     set_gdbarch_long_double_bit (gdbarch, 128);
> -  set_gdbarch_long_double_format (gdbarch, floatformats_mips64_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   
>     obsd_init_abi(info, gdbarch);
>   
> diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
> index 0b165fe..63cffbd 100644
> --- a/gdb/ppc-linux-tdep.c
> +++ b/gdb/ppc-linux-tdep.c
> @@ -1974,7 +1974,7 @@ ppc_floatformat_for_type (struct gdbarch *gdbarch,
>   	  || strcmp (name, "_Float64x") == 0
>   	  || strcmp (name, "complex _Float128") == 0
>   	  || strcmp (name, "complex _Float64x") == 0)
> -	return floatformats_ia64_quad;
> +	return floatformats_ieee_quad;
>   
>         if (strcmp (name, "__ibm128") == 0)
>   	return floatformats_ibm_long_double;
> @@ -2053,7 +2053,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
>        to distinguish between the IBM long double and IEEE quad cases.  */
>     set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
>     if (tdep->long_double_abi == POWERPC_LONG_DOUBLE_IEEE128)
> -    set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +    set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>     else
>       set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
>   
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index 886996c..036577d 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -3769,7 +3769,7 @@ riscv_gdbarch_init (struct gdbarch_info info,
>     set_gdbarch_float_bit (gdbarch, 32);
>     set_gdbarch_double_bit (gdbarch, 64);
>     set_gdbarch_long_double_bit (gdbarch, 128);
> -  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>     set_gdbarch_ptr_bit (gdbarch, riscv_isa_xlen (gdbarch) * 8);
>     set_gdbarch_char_signed (gdbarch, 0);
>     set_gdbarch_type_align (gdbarch, riscv_type_align);
> diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> index ee3f051..7016ed3 100644
> --- a/gdb/rs6000-tdep.c
> +++ b/gdb/rs6000-tdep.c
> @@ -2434,7 +2434,7 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
>   
>         /* PPC specific type for IEEE 128-bit float field */
>         struct type *t_float128
> -	= arch_float_type (gdbarch, 128, "float128_t", floatformats_ia64_quad);
> +	= arch_float_type (gdbarch, 128, "float128_t", floatformats_ieee_quad);
>   
>         struct type *t;
>   
> diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
> index 153f0ed..cf53c6d 100644
> --- a/gdb/s390-tdep.c
> +++ b/gdb/s390-tdep.c
> @@ -7038,7 +7038,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>        We can safely let them default to 128-bit, since the debug info
>        will give the size of type actually used in each case.  */
>     set_gdbarch_long_double_bit (gdbarch, 128);
> -  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   
>     set_gdbarch_type_align (gdbarch, s390_type_align);
>   
> diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
> index 03242ed..1d90bb1 100644
> --- a/gdb/sparc-tdep.c
> +++ b/gdb/sparc-tdep.c
> @@ -61,10 +61,6 @@ struct regset;
>      code that can handle both.  The 64-bit specific code lives in
>      sparc64-tdep.c; don't add any here.  */
>   
> -/* The SPARC Floating-Point Quad-Precision format is similar to
> -   big-endian IA-64 Quad-Precision format.  */
> -#define floatformats_sparc_quad floatformats_ia64_quad
> -
>   /* The stack pointer is offset from the stack frame by a BIAS of 2047
>      (0x7ff) for 64-bit code.  BIAS is likely to be defined on SPARC
>      hosts, so undefine it first.  */
> @@ -1838,7 +1834,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>     tdep->cp0_registers_num = ARRAY_SIZE (sparc32_cp0_register_names);
>   
>     set_gdbarch_long_double_bit (gdbarch, 128);
> -  set_gdbarch_long_double_format (gdbarch, floatformats_sparc_quad);
> +  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
>   
>     set_gdbarch_wchar_bit (gdbarch, 16);
>     set_gdbarch_wchar_signed (gdbarch, 1);
> diff --git a/include/floatformat.h b/include/floatformat.h
> index c851879..ffb02f9 100644
> --- a/include/floatformat.h
> +++ b/include/floatformat.h
> @@ -97,7 +97,7 @@ struct floatformat
>     const struct floatformat *split_half;
>   };
>   
> -/* floatformats for IEEE single and double, big and little endian.  */
> +/* floatformats for IEEE half, single, double and quad, big and little endian.  */
>   
>   extern const struct floatformat floatformat_ieee_half_big;
>   extern const struct floatformat floatformat_ieee_half_little;
> @@ -105,6 +105,8 @@ extern const struct floatformat floatformat_ieee_single_big;
>   extern const struct floatformat floatformat_ieee_single_little;
>   extern const struct floatformat floatformat_ieee_double_big;
>   extern const struct floatformat floatformat_ieee_double_little;
> +extern const struct floatformat floatformat_ieee_quad_big;
> +extern const struct floatformat floatformat_ieee_quad_little;
>   
>   /* floatformat for ARM IEEE double, little endian bytes and big endian words */
>   
> @@ -128,8 +130,6 @@ extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
>   /* IA-64 Floating Point register spilt into memory.  */
>   extern const struct floatformat floatformat_ia64_spill_big;
>   extern const struct floatformat floatformat_ia64_spill_little;
> -extern const struct floatformat floatformat_ia64_quad_big;
> -extern const struct floatformat floatformat_ia64_quad_little;
>   /* IBM long double (double+double).  */
>   extern const struct floatformat floatformat_ibm_long_double_big;
>   extern const struct floatformat floatformat_ibm_long_double_little;
> diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
> index ce36bae..f93568b 100644
> --- a/libiberty/floatformat.c
> +++ b/libiberty/floatformat.c
> @@ -78,7 +78,7 @@ floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
>      a system header, what we do if not, etc.  */
>   #define FLOATFORMAT_CHAR_BIT 8
>   
> -/* floatformats for IEEE half, single and double, big and little endian.  */
> +/* floatformats for IEEE half, single, double and quad, big and little endian.  */
>   const struct floatformat floatformat_ieee_half_big =
>   {
>     floatformat_big, 16, 0, 1, 5, 15, 31, 6, 10,
> @@ -127,6 +127,22 @@ const struct floatformat floatformat_ieee_double_little =
>     floatformat_always_valid,
>     NULL
>   };
> +const struct floatformat floatformat_ieee_quad_big =
> +{
> +  floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
> +  floatformat_intbit_no,
> +  "floatformat_ieee_quad_big",
> +  floatformat_always_valid,
> +  NULL
> +};
> +const struct floatformat floatformat_ieee_quad_little =
> +{
> +  floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
> +  floatformat_intbit_no,
> +  "floatformat_ieee_quad_little",
> +  floatformat_always_valid,
> +  NULL
> +};
>   
>   /* floatformat for IEEE double, little endian byte order, with big endian word
>      ordering, as on the ARM.  */
> @@ -269,22 +285,6 @@ const struct floatformat floatformat_ia64_spill_little =
>     floatformat_always_valid,
>     NULL
>   };
> -const struct floatformat floatformat_ia64_quad_big =
> -{
> -  floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
> -  floatformat_intbit_no,
> -  "floatformat_ia64_quad_big",
> -  floatformat_always_valid,
> -  NULL
> -};
> -const struct floatformat floatformat_ia64_quad_little =
> -{
> -  floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
> -  floatformat_intbit_no,
> -  "floatformat_ia64_quad_little",
> -  floatformat_always_valid,
> -  NULL
> -};
>   
>   static int
>   floatformat_ibm_long_double_is_valid (const struct floatformat *fmt,


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad
  2022-03-08 12:00 ` [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad Tiezhu Yang
  2022-03-09 14:24   ` Luis Machado
@ 2022-03-11 14:49   ` Tom Tromey
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2022-03-11 14:49 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: gdb-patches

>>>>> Tiezhu Yang <yangtiezhu@loongson.cn> writes:

> It is better to rename floatformats_ia64_quad to floatformats_ieee_quad
> to reflect the reality, and then we can clean up the related code.

>  include/floatformat.h   |  6 +++---
>  libiberty/floatformat.c | 34 +++++++++++++++++-----------------

These files are maintained in gcc and then imported into the
binutils-gdb repository, so any changes to them will have to be proposed
there first.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp
  2022-03-08 12:00 ` [PATCH 2/2] gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp Tiezhu Yang
@ 2022-03-11 14:51   ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2022-03-11 14:51 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: gdb-patches

>>>>> Tiezhu Yang <yangtiezhu@loongson.cn> writes:

> When execute the following command on LoongArch:
>   make check-gdb TESTS="gdb.base/align-c.exp"

> there exists some failed testcases:

>   ...
>   FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_float)
>   FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_double)
>   FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_long_double)
>   ...

> According to LoongArch ELF ABI specification [1], set the target data types
> of floating-point to fix the above failed testcases.

Looks good to me.
If you want to reword this to land it before the floatformat renaming,
that's also fine.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-11 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 12:00 [PATCH 0/2] gdb: rename floatformats_ia64_quad and fix failed testcases Tiezhu Yang
2022-03-08 12:00 ` [PATCH 1/2] gdb: rename floatformats_ia64_quad to floatformats_ieee_quad Tiezhu Yang
2022-03-09 14:24   ` Luis Machado
2022-03-11 14:49   ` Tom Tromey
2022-03-08 12:00 ` [PATCH 2/2] gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp Tiezhu Yang
2022-03-11 14:51   ` Tom Tromey

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).