diff mbox series

[PING] floatformat.h: Add bfloat16 support.

Message ID a4e9a5fa2f4b40638a5bb8222cebdf3b@intel.com
State New
Headers show
Series [PING] floatformat.h: Add bfloat16 support. | expand

Commit Message

Li, Pan2 via Gcc-patches Sept. 7, 2020, 11:04 a.m. UTC
Kindly pinging.

Felix

-----Original Message-----
From: Felix Willgerodt <felix.willgerodt@intel.com> 
Sent: Montag, 17. August 2020 13:37
To: Willgerodt, Felix <felix.willgerodt@intel.com>; gcc-patches@gcc.gnu.org
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  <felix.willgerodt@intel.com>

	* floatformat.h (floatformat_bfloat16_big): New.
	(floatformat_bfloat16_little): New.

libiberty:
2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

	* 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(-)


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Comments

Joseph Myers Sept. 7, 2020, 7:44 p.m. UTC | #1
On Mon, 7 Sep 2020, Willgerodt, Felix via Gcc-patches wrote:

> @@ -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;

There seems to be something odd about the diff formatting here.  I'd 
expect each declaration to be on its own line, not "extern const" at the 
end of a line and the rest of a declaration on the next line.  OK with 
that fixed.
Li, Pan2 via Gcc-patches Sept. 8, 2020, 7:43 a.m. UTC | #2
Thanks for your review. It seems like the format issue was introduced by my email client when hitting reply. Sorry for that!
The original patch is formatted correctly, as I used git send-email: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552079.html

Could you double-check and push the patch for me? This is the first time I contribute to gcc and I therefore don't have write access.

Regards,
Felix

-----Original Message-----
From: Joseph Myers <joseph@codesourcery.com> 
Sent: Montag, 7. September 2020 21:45
To: Willgerodt, Felix <felix.willgerodt@intel.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PING] floatformat.h: Add bfloat16 support.

On Mon, 7 Sep 2020, Willgerodt, Felix via Gcc-patches wrote:

> @@ -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;

There seems to be something odd about the diff formatting here.  I'd expect each declaration to be on its own line, not "extern const" at the end of a line and the rest of a declaration on the next line.  OK with that fixed.

--
Joseph S. Myers
mailto:joseph@codesourcery.com
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
Joseph Myers Sept. 8, 2020, 5:39 p.m. UTC | #3
On Tue, 8 Sep 2020, Willgerodt, Felix via Gcc-patches wrote:

> Thanks for your review. It seems like the format issue was introduced by 
> my email client when hitting reply. Sorry for that! The original patch 
> is formatted correctly, as I used git send-email: 
> https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552079.html
> 
> Could you double-check and push the patch for me? This is the first time 
> I contribute to gcc and I therefore don't have write access.

I've now pushed this patch.
Li, Pan2 via Gcc-patches Sept. 9, 2020, 1:32 p.m. UTC | #4
Thank you!

Felix

-----Original Message-----
From: Joseph Myers <joseph@codesourcery.com> 
Sent: Dienstag, 8. September 2020 19:40
To: Willgerodt, Felix <felix.willgerodt@intel.com>
Cc: gcc-patches@gcc.gnu.org
Subject: RE: [PING] floatformat.h: Add bfloat16 support.

On Tue, 8 Sep 2020, Willgerodt, Felix via Gcc-patches wrote:

> Thanks for your review. It seems like the format issue was introduced 
> by my email client when hitting reply. Sorry for that! The original 
> patch is formatted correctly, as I used git send-email:
> https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552079.html
> 
> Could you double-check and push the patch for me? This is the first 
> time I contribute to gcc and I therefore don't have write access.

I've now pushed this patch.

--
Joseph S. Myers
joseph@codesourcery.com
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
diff mbox series

Patch

diff --git a/include/floatformat.h b/include/floatformat.h index ce8d6d4add8..630fade0449 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 2fd5e688ec4..6b9b03288e2 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.25.4