[v2,1/5] gdb: define additional integer built-in types

Message ID 20261030115016.45786-2-stephan.rohr@intel.com
State New
Headers
Series Add Intel AMX support |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply

Commit Message

Rohr, Stephan Oct. 30, 2026, 11:50 a.m. UTC
  From: Aleksandar Paunovic <aleksandar.paunovic@intel.com>

Allow using int256/int512 and uint256/uint512 as built-in types,
particularly for the target descriptions.

This is in preparation to add Intel AMX registers.

Co-Authored-By: Stephan Rohr <stephan.rohr@intel.com>
---
 gdb/doc/gdb.texinfo       |  4 ++++
 gdb/gdbtypes.c            |  8 ++++++++
 gdb/gdbtypes.h            |  4 ++++
 gdb/target-descriptions.c | 12 ++++++++++++
 gdbsupport/tdesc.cc       |  4 ++++
 gdbsupport/tdesc.h        |  4 ++++
 6 files changed, 36 insertions(+)
  

Comments

Eli Zaretskii Oct. 30, 2026, 12:45 p.m. UTC | #1
> From: Stephan Rohr <stephan.rohr@intel.com>
> Cc: pedro@palves.net,
> 	eliz@gnu.org,
> 	jhb@FreeBSD.org,
> 	luis.machado@arm.com
> Date: Fri, 30 Oct 2026 11:50:12 +0000
> 
> From: Aleksandar Paunovic <aleksandar.paunovic@intel.com>
> 
> Allow using int256/int512 and uint256/uint512 as built-in types,
> particularly for the target descriptions.
> 
> This is in preparation to add Intel AMX registers.
> 
> Co-Authored-By: Stephan Rohr <stephan.rohr@intel.com>
> ---
>  gdb/doc/gdb.texinfo       |  4 ++++
>  gdb/gdbtypes.c            |  8 ++++++++
>  gdb/gdbtypes.h            |  4 ++++
>  gdb/target-descriptions.c | 12 ++++++++++++
>  gdbsupport/tdesc.cc       |  4 ++++
>  gdbsupport/tdesc.h        |  4 ++++
>  6 files changed, 36 insertions(+)

Thanks, the gdb.texinfo part isokay.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
  

Patch

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 66152d2582e..53773780b56 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -49859,6 +49859,8 @@  Boolean type, occupying a single bit.
 @itemx int32
 @itemx int64
 @itemx int128
+@itemx int256
+@itemx int512
 Signed integer types holding the specified number of bits.
 
 @item uint8
@@ -49867,6 +49869,8 @@  Signed integer types holding the specified number of bits.
 @itemx uint32
 @itemx uint64
 @itemx uint128
+@itemx uint256
+@itemx uint512
 Unsigned integer types holding the specified number of bits.
 
 @item code_ptr
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index f86549aca88..132f30a08b7 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5727,6 +5727,14 @@  create_gdbtypes_data (struct gdbarch *gdbarch)
     = init_integer_type (alloc, 128, 0, "int128_t");
   builtin_type->builtin_uint128
     = init_integer_type (alloc, 128, 1, "uint128_t");
+  builtin_type->builtin_int256
+    = init_integer_type (alloc, 256, 0, "int256_t");
+  builtin_type->builtin_uint256
+    = init_integer_type (alloc, 256, 1, "uint256_t");
+  builtin_type->builtin_int512
+    = init_integer_type (alloc, 512, 0, "int512_t");
+  builtin_type->builtin_uint512
+    = init_integer_type (alloc, 512, 1, "uint512_t");
 
   builtin_type->builtin_int8->set_nottext (true);
   builtin_type->builtin_uint8->set_nottext (true);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2c49b83246c..afb9a65ee3d 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2144,6 +2144,10 @@  struct builtin_type
   struct type *builtin_uint64 = nullptr;
   struct type *builtin_int128 = nullptr;
   struct type *builtin_uint128 = nullptr;
+  struct type *builtin_int256 = nullptr;
+  struct type *builtin_uint256 = nullptr;
+  struct type *builtin_int512 = nullptr;
+  struct type *builtin_uint512 = nullptr;
 
   /* Wide character types.  */
   struct type *builtin_char16 = nullptr;
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index e1821fe7114..f8e102872ca 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -86,6 +86,12 @@  make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
 	case TDESC_TYPE_INT128:
 	  m_type = builtin_type (m_gdbarch)->builtin_int128;
 	  return;
+	case TDESC_TYPE_INT256:
+	  m_type = builtin_type (m_gdbarch)->builtin_int256;
+	  return;
+	case TDESC_TYPE_INT512:
+	  m_type = builtin_type (m_gdbarch)->builtin_int512;
+	  return;
 	case TDESC_TYPE_UINT8:
 	  m_type = builtin_type (m_gdbarch)->builtin_uint8;
 	  return;
@@ -101,6 +107,12 @@  make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
 	case TDESC_TYPE_UINT128:
 	  m_type = builtin_type (m_gdbarch)->builtin_uint128;
 	  return;
+	case TDESC_TYPE_UINT256:
+	  m_type = builtin_type (m_gdbarch)->builtin_uint256;
+	  return;
+	case TDESC_TYPE_UINT512:
+	  m_type = builtin_type (m_gdbarch)->builtin_uint512;
+	  return;
 	case TDESC_TYPE_CODE_PTR:
 	  m_type = builtin_type (m_gdbarch)->builtin_func_ptr;
 	  return;
diff --git a/gdbsupport/tdesc.cc b/gdbsupport/tdesc.cc
index 4b6aa815c81..19995a2d407 100644
--- a/gdbsupport/tdesc.cc
+++ b/gdbsupport/tdesc.cc
@@ -42,11 +42,15 @@  static tdesc_type_builtin tdesc_predefined_types[] =
   { "int32", TDESC_TYPE_INT32 },
   { "int64", TDESC_TYPE_INT64 },
   { "int128", TDESC_TYPE_INT128 },
+  { "int256", TDESC_TYPE_INT256 },
+  { "int512", TDESC_TYPE_INT512 },
   { "uint8", TDESC_TYPE_UINT8 },
   { "uint16", TDESC_TYPE_UINT16 },
   { "uint32", TDESC_TYPE_UINT32 },
   { "uint64", TDESC_TYPE_UINT64 },
   { "uint128", TDESC_TYPE_UINT128 },
+  { "uint256", TDESC_TYPE_UINT256 },
+  { "uint512", TDESC_TYPE_UINT512 },
   { "code_ptr", TDESC_TYPE_CODE_PTR },
   { "data_ptr", TDESC_TYPE_DATA_PTR },
   { "ieee_half", TDESC_TYPE_IEEE_HALF },
diff --git a/gdbsupport/tdesc.h b/gdbsupport/tdesc.h
index a2ef21987bf..cadaa38410c 100644
--- a/gdbsupport/tdesc.h
+++ b/gdbsupport/tdesc.h
@@ -163,11 +163,15 @@  enum tdesc_type_kind
   TDESC_TYPE_INT32,
   TDESC_TYPE_INT64,
   TDESC_TYPE_INT128,
+  TDESC_TYPE_INT256,
+  TDESC_TYPE_INT512,
   TDESC_TYPE_UINT8,
   TDESC_TYPE_UINT16,
   TDESC_TYPE_UINT32,
   TDESC_TYPE_UINT64,
   TDESC_TYPE_UINT128,
+  TDESC_TYPE_UINT256,
+  TDESC_TYPE_UINT512,
   TDESC_TYPE_CODE_PTR,
   TDESC_TYPE_DATA_PTR,
   TDESC_TYPE_IEEE_HALF,