public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Felix Willgerodt <felix.willgerodt@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/1] gdb, i386: Enable AVX512-bfloat16 for i386 targets.
Date: Thu, 29 Jul 2021 15:05:27 +0200	[thread overview]
Message-ID: <20210729130527.2527663-1-felix.willgerodt@intel.com> (raw)

Values of type bfloat16 can also be used on 32-bit targets, which was missed
in the original enablement.  This also adjusts the testcase to pass with
"unix/-m32", where only the lower 8 AVX registers are available.

gdb/ChangeLog:
2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>

	* features/i386/32bit-sse.xml: Add bfloat16 type.
	* features/i386/32bit-sse.c: Regenerated.

gdb/testsuite/ChangeLog:
2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>

	* gdb.arch/x86-avx512bf16.exp: Only use x/z/ymm 0-7.
---
 gdb/features/i386/32bit-sse.c             |  5 +++++
 gdb/features/i386/32bit-sse.xml           |  2 ++
 gdb/testsuite/gdb.arch/x86-avx512bf16.exp | 12 ++++++------
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/gdb/features/i386/32bit-sse.c b/gdb/features/i386/32bit-sse.c
index e5eaf8feb59..b6d5fbaf0fc 100644
--- a/gdb/features/i386/32bit-sse.c
+++ b/gdb/features/i386/32bit-sse.c
@@ -10,6 +10,9 @@ create_feature_i386_32bit_sse (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse");
   tdesc_type *element_type;
+  element_type = tdesc_named_type (feature, "bfloat16");
+  tdesc_create_vector (feature, "v8bf16", element_type, 8);
+
   element_type = tdesc_named_type (feature, "ieee_single");
   tdesc_create_vector (feature, "v4f", element_type, 4);
 
@@ -31,6 +34,8 @@ create_feature_i386_32bit_sse (struct target_desc *result, long regnum)
   tdesc_type_with_fields *type_with_fields;
   type_with_fields = tdesc_create_union (feature, "vec128");
   tdesc_type *field_type;
+  field_type = tdesc_named_type (feature, "v8bf16");
+  tdesc_add_field (type_with_fields, "v8_bfloat16", field_type);
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
diff --git a/gdb/features/i386/32bit-sse.xml b/gdb/features/i386/32bit-sse.xml
index 7bf3e0f3828..8710622e944 100644
--- a/gdb/features/i386/32bit-sse.xml
+++ b/gdb/features/i386/32bit-sse.xml
@@ -7,6 +7,7 @@
 
 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
 <feature name="org.gnu.gdb.i386.sse">
+  <vector id="v8bf16" type="bfloat16" count="8"/>
   <vector id="v4f" type="ieee_single" count="4"/>
   <vector id="v2d" type="ieee_double" count="2"/>
   <vector id="v16i8" type="int8" count="16"/>
@@ -14,6 +15,7 @@
   <vector id="v4i32" type="int32" count="4"/>
   <vector id="v2i64" type="int64" count="2"/>
   <union id="vec128">
+    <field name="v8_bfloat16" type="v8bf16"/>
     <field name="v4_float" type="v4f"/>
     <field name="v2_double" type="v2d"/>
     <field name="v16_int8" type="v16i8"/>
diff --git a/gdb/testsuite/gdb.arch/x86-avx512bf16.exp b/gdb/testsuite/gdb.arch/x86-avx512bf16.exp
index 20528169c64..528e79f02df 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512bf16.exp
+++ b/gdb/testsuite/gdb.arch/x86-avx512bf16.exp
@@ -64,11 +64,11 @@ gdb_test "print \$zmm6.v32_bfloat16\[1\]" "= 68.5"
 # Test setting of bfloat values
 gdb_test_no_output "set var \$xmm0.v8_bfloat16\[0\] = 32.25" \
     "set %xmm0.v8_bfloat16\[0\]"
-gdb_test_no_output "set var \$ymm8.v16_bfloat16\[1\] = 33.5" \
-    "set %ymm8.v16_bfloat16\[1\]"
-gdb_test_no_output "set var \$zmm16.v32_bfloat16\[2\] = 22.75" \
-    "set %zmm16.v32_bfloat16\[2\]"
+gdb_test_no_output "set var \$ymm4.v16_bfloat16\[1\] = 33.5" \
+    "set %ymm4.v16_bfloat16\[1\]"
+gdb_test_no_output "set var \$zmm7.v32_bfloat16\[2\] = 22.75" \
+    "set %zmm7.v32_bfloat16\[2\]"
 
 gdb_test "p \$xmm0.v8_bfloat16\[0\]" "= 32.25"
-gdb_test "p \$ymm8.v16_bfloat16\[1\]" "= 33.5"
-gdb_test "p \$zmm16.v32_bfloat16\[2\]" "= 22.75"
+gdb_test "p \$ymm4.v16_bfloat16\[1\]" "= 33.5"
+gdb_test "p \$zmm7.v32_bfloat16\[2\]" "= 22.75"
-- 
2.25.4

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


             reply	other threads:[~2021-07-29 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 13:05 Felix Willgerodt [this message]
2021-09-03 12:26 ` Simon Marchi
2021-09-03 13:05   ` Willgerodt, Felix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210729130527.2527663-1-felix.willgerodt@intel.com \
    --to=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).