Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] SSE register type fix
@ 2002-05-17 12:29 Martin M. Hunt
  2002-05-17 12:46 ` Elena Zannoni
  0 siblings, 1 reply; 6+ messages in thread
From: Martin M. Hunt @ 2002-05-17 12:29 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

This patch adds better support for displaying SSE2 registers and changes 
support for SSE registers. It also allows them to work with the latest 
Insight.

Previously registers were displayed as:
(gdb) p $xmm0
$1 = {f = {0, 0, 0, 0}}

With this patch they will be printed as:

(gdb) p $xmm0
$1 = {v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = '\0' <repeats 15 
times>, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, 
v2_int64 = {0, 0}, uint128 = 0x00000000000000000000000000000000}

or you can do

(gdb) p $xmm0.v4_float
$2 = {0, 0, 0, 0}

Right now the code prints the register as if it were SSE2.  For SSE registers, 
only v4_float is actually used. 

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.

2002-05-17  Martin M. Hunt  <hunt@redhat.com>

	* i386-tdep.c (i386_register_virtual_type): Return 
	builtin_type_vec128i for SSE registers.

	* gdbtypes.h (builtin_type_vec128i): Declare.

	* gdbtypes.c (build_builtin_type_vec128i): New function.
	(builtin_type_v2_double, builtin_type_v4_int64): New types.
	(builtin_type_vec128i): New type for SSE2 128-bit registers.
	(build_gdbtypes): Initialize new builtin vector types.
	(_initialize_gdbtypes): Register new vector types with gdbarch.



[-- Attachment #2: sse_patch --]
[-- Type: text/x-diff, Size: 4779 bytes --]

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.54
diff -u -u -r1.54 i386-tdep.c
--- i386-tdep.c	9 May 2002 13:53:36 -0000	1.54
+++ i386-tdep.c	17 May 2002 19:15:01 -0000
@@ -1058,7 +1058,7 @@
     return builtin_type_i387_ext;
 
   if (IS_SSE_REGNUM (regnum))
-    return builtin_type_v4sf;
+    return builtin_type_vec128i;
 
   return builtin_type_int;
 }
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.31
diff -u -u -r1.31 gdbtypes.h
--- gdbtypes.h	16 May 2002 03:59:58 -0000	1.31
+++ gdbtypes.h	17 May 2002 19:15:01 -0000
@@ -963,6 +963,7 @@
 
 /* Type for 128 bit vectors. */
 extern struct type *builtin_type_vec128;
+extern struct type *builtin_type_vec128i;
 
 /* Explicit floating-point formats.  See "floatformat.h".  */
 extern struct type *builtin_type_ieee_single_big;
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.51
diff -u -u -r1.51 gdbtypes.c
--- gdbtypes.c	14 May 2002 18:30:50 -0000	1.51
+++ gdbtypes.c	17 May 2002 19:15:02 -0000
@@ -73,7 +73,9 @@
 struct type *builtin_type_bool;
 
 /* 128 bit long vector types */
+struct type *builtin_type_v2_double;
 struct type *builtin_type_v4_float;
+struct type *builtin_type_v2_int64;
 struct type *builtin_type_v4_int32;
 struct type *builtin_type_v8_int16;
 struct type *builtin_type_v16_int8;
@@ -91,6 +93,7 @@
 struct type *builtin_type_v4hi;
 struct type *builtin_type_v2si;
 struct type *builtin_type_vec128;
+struct type *builtin_type_vec128i;
 struct type *builtin_type_ieee_single_big;
 struct type *builtin_type_ieee_single_little;
 struct type *builtin_type_ieee_double_big;
@@ -844,6 +847,24 @@
   return t;
 }
 
+static struct type *
+build_builtin_type_vec128i (void)
+{
+  /* 128-bit Intel SIMD registers */
+  struct type *t;
+
+  t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
+  append_composite_type_field (t, "v4_float", builtin_type_v4_float);
+  append_composite_type_field (t, "v2_double", builtin_type_v2_double);
+  append_composite_type_field (t, "v16_int8", builtin_type_v16_int8);
+  append_composite_type_field (t, "v8_int16", builtin_type_v8_int16);
+  append_composite_type_field (t, "v4_int32", builtin_type_v4_int32);
+  append_composite_type_field (t, "v2_int64", builtin_type_v2_int64);
+  append_composite_type_field (t, "uint128", builtin_type_int128);
+
+  return t;
+}
+
 /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE. 
    A MEMBER is a wierd thing -- it amounts to a typed offset into
    a struct, e.g. "an int at offset 8".  A MEMBER TYPE doesn't
@@ -3300,7 +3321,9 @@
     = init_simd_type ("__builtin_v2si", builtin_type_int32, "f", 2);
 
   /* 128 bit vectors.  */
+  builtin_type_v2_double = init_vector_type (builtin_type_double, 2);
   builtin_type_v4_float = init_vector_type (builtin_type_float, 4);
+  builtin_type_v2_int64 = init_vector_type (builtin_type_int64, 2);
   builtin_type_v4_int32 = init_vector_type (builtin_type_int32, 4);
   builtin_type_v8_int16 = init_vector_type (builtin_type_int16, 8);
   builtin_type_v16_int8 = init_vector_type (builtin_type_int8, 16);
@@ -3312,6 +3335,7 @@
 
   /* Vector types. */
   builtin_type_vec128 = build_builtin_type_vec128 ();
+  builtin_type_vec128i = build_builtin_type_vec128i ();
 
   /* Pointer/Address types. */
 
@@ -3400,7 +3424,9 @@
   register_gdbarch_swap (&builtin_type_v8hi, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_v2_double, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v4_float, sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_v2_int64, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v4_int32, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v8_int16, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v16_int8, sizeof (struct type *), NULL);
@@ -3409,6 +3435,7 @@
   register_gdbarch_swap (&builtin_type_v8_int8, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_v4_int16, sizeof (struct type *), NULL);
   register_gdbarch_swap (&builtin_type_vec128, sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_vec128i, sizeof (struct type *), NULL);
   REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr);
   REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr);
   REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-05-27  9:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-17 12:29 [RFA] SSE register type fix Martin M. Hunt
2002-05-17 12:46 ` Elena Zannoni
2002-05-17 13:07   ` Andrew Cagney
2002-05-17 13:19   ` Martin M. Hunt
2002-05-17 15:25     ` Elena Zannoni
2002-05-27  6:18   ` Martin M. Hunt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox