From 87603e565615db055f7f60db0c9888f71d233826 Mon Sep 17 00:00:00 2001 From: Felix Willgerodt Date: Mon, 17 Aug 2020 13:36:49 +0200 Subject: [PATCH] floatformat.h: Add bfloat16 support. This change is motivated by a patchset that adds bfloat16 debugging support for new avx512 instructions to GDB. The gdb thread can be found here: https://sourceware.org/pipermail/gdb-patches/2020-July/170820.html include: 2020-08-17 Felix Willgerodt * floatformat.h (floatformat_bfloat16_big): New. (floatformat_bfloat16_little): New. libiberty: 2020-08-17 Felix Willgerodt * floatformat.c (floatformat_bfloat16_big): New. (floatformat_bfloat16_little): New. --- include/floatformat.h | 3 +++ libiberty/floatformat.c | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/floatformat.h b/include/floatformat.h index ce8d6d4..630fade 100644 --- a/include/floatformat.h +++ b/include/floatformat.h @@ -133,6 +133,9 @@ 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; +/* bfloat16. */ +extern const struct floatformat floatformat_bfloat16_big; +extern const struct floatformat floatformat_bfloat16_little; /* Convert from FMT to a double. FROM is the address of the extended float. diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index 2fd5e68..6b9b032 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -389,7 +389,24 @@ const struct floatformat floatformat_ibm_long_double_little = floatformat_ibm_long_double_is_valid, &floatformat_ieee_double_little }; - + +const struct floatformat floatformat_bfloat16_big = +{ + floatformat_big, 16, 0, 1, 8, 127, 255, 9, 7, + floatformat_intbit_no, + "floatformat_bfloat16_big", + floatformat_always_valid, + NULL +}; + +const struct floatformat floatformat_bfloat16_little = +{ + floatformat_little, 16, 0, 1, 8, 127, 255, 9, 7, + floatformat_intbit_no, + "floatformat_bfloat16_little", + floatformat_always_valid, + NULL +}; #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) -- 2.7.4