diff options
author | Felix Willgerodt <felix.willgerodt@intel.com> | 2020-09-10 14:29:53 +0200 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2020-09-11 11:42:47 -0700 |
commit | 2a67f09db1b70bf55fa88cf2dbb6755210e0e218 (patch) | |
tree | d8e892091e998a3e0a7c96116ddb42cfdd688d16 /gdb/gdbarch.c | |
parent | 1347d111096835049841f2039a4d5852404606a3 (diff) | |
download | fsf-binutils-gdb-2a67f09db1b70bf55fa88cf2dbb6755210e0e218.zip fsf-binutils-gdb-2a67f09db1b70bf55fa88cf2dbb6755210e0e218.tar.gz fsf-binutils-gdb-2a67f09db1b70bf55fa88cf2dbb6755210e0e218.tar.bz2 |
Add bfloat16 support for AVX512 register view.
This adds support for the bfloat16 datatype, which can be seen as a short
version of FP32, skipping the least significant 16 bits of the mantissa.
Since the datatype is currently only supported by the AVX512 registers,
the printing of bfloat16 values is only supported for xmm, ymm and zmm
registers.
gdb/ChangeLog:
2020-09-11 Moritz Riesterer <moritz.riesterer@intel.com>
Felix Willgerodt <Felix.Willgerodt@intel.com>
* gdbarch.sh: Added bfloat16 type.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_bfloat16): New struct.
(gdbtypes_post_init): Add builtin_bfloat16.
* gdbtypes.h (struct builtin_type) <builtin_bfloat16>: New member.
(floatformats_bfloat16): New struct.
* i386-tdep.c (i386_zmm_type): Add field "v32_bfloat16"
(i386_ymm_type): Add field "v16_bfloat16"
(i386_gdbarch_init): Add set_gdbarch_bfloat16_format.
* target-descriptions.c (make_gdb_type): Add case TDESC_TYPE_BFLOAT16.
* gdbsupport/tdesc.cc (tdesc_predefined_types): New member bfloat16.
* gdbsupport/tdesc.h (tdesc_type_kind): New member TDESC_TYPE_BFLOAT16.
* features/i386/64bit-avx512.xml: Add bfloat16 type.
* features/i386/64bit-avx512.c: Regenerated.
* features/i386/64bit-sse.xml: Add bfloat16 type.
* features/i386/64bit-sse.c: Regenerated.
gdb/testsuite/ChangeLog:
2020-09-11 Moritz Riesterer <moritz.riesterer@intel.com>
Felix Willgerodt <Felix.Willgerodt@intel.com>
* x86-avx512bf16.c: New file.
* x86-avx512bf16.exp: Likewise.
* lib/gdb.exp (skip_avx512bf16_tests): New function.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r-- | gdb/gdbarch.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index f8fe03c..062c86b 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -166,6 +166,8 @@ struct gdbarch int int_bit; int long_bit; int long_long_bit; + int bfloat16_bit; + const struct floatformat ** bfloat16_format; int half_bit; const struct floatformat ** half_format; int float_bit; @@ -383,6 +385,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->int_bit = 4*TARGET_CHAR_BIT; gdbarch->long_bit = 4*TARGET_CHAR_BIT; gdbarch->long_long_bit = 2*gdbarch->long_bit; + gdbarch->bfloat16_bit = 2*TARGET_CHAR_BIT; gdbarch->half_bit = 2*TARGET_CHAR_BIT; gdbarch->float_bit = 4*TARGET_CHAR_BIT; gdbarch->double_bit = 8*TARGET_CHAR_BIT; @@ -523,6 +526,9 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of int_bit, invalid_p == 0 */ /* Skip verify of long_bit, invalid_p == 0 */ /* Skip verify of long_long_bit, invalid_p == 0 */ + /* Skip verify of bfloat16_bit, invalid_p == 0 */ + if (gdbarch->bfloat16_format == 0) + gdbarch->bfloat16_format = floatformats_bfloat16; /* Skip verify of half_bit, invalid_p == 0 */ if (gdbarch->half_format == 0) gdbarch->half_format = floatformats_ieee_half; @@ -808,6 +814,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: bfd_arch_info = %s\n", gdbarch_bfd_arch_info (gdbarch)->printable_name); fprintf_unfiltered (file, + "gdbarch_dump: bfloat16_bit = %s\n", + plongest (gdbarch->bfloat16_bit)); + fprintf_unfiltered (file, + "gdbarch_dump: bfloat16_format = %s\n", + pformat (gdbarch->bfloat16_format)); + fprintf_unfiltered (file, "gdbarch_dump: breakpoint_from_pc = <%s>\n", host_address_to_string (gdbarch->breakpoint_from_pc)); fprintf_unfiltered (file, @@ -1621,6 +1633,39 @@ set_gdbarch_long_long_bit (struct gdbarch *gdbarch, } int +gdbarch_bfloat16_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of bfloat16_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_bfloat16_bit called\n"); + return gdbarch->bfloat16_bit; +} + +void +set_gdbarch_bfloat16_bit (struct gdbarch *gdbarch, + int bfloat16_bit) +{ + gdbarch->bfloat16_bit = bfloat16_bit; +} + +const struct floatformat ** +gdbarch_bfloat16_format (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_bfloat16_format called\n"); + return gdbarch->bfloat16_format; +} + +void +set_gdbarch_bfloat16_format (struct gdbarch *gdbarch, + const struct floatformat ** bfloat16_format) +{ + gdbarch->bfloat16_format = bfloat16_format; +} + +int gdbarch_half_bit (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); |