From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30819 invoked by alias); 17 May 2002 19:29:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30798 invoked from network); 17 May 2002 19:29:01 -0000 Received: from unknown (HELO potter.sfbay.redhat.com) (205.180.83.107) by sources.redhat.com with SMTP; 17 May 2002 19:29:01 -0000 Received: from localhost.localdomain (remus.sfbay.redhat.com [172.16.27.252]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g4HJRSv13236 for ; Fri, 17 May 2002 12:27:28 -0700 From: "Martin M. Hunt" Organization: Red Hat Inc To: gdb-patches@sources.redhat.com Subject: [RFA] SSE register type fix Date: Fri, 17 May 2002 12:29:00 -0000 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_XQS9SHHH8P6NSM3R000F" Message-Id: <200205171228.09802.hunt@redhat.com> X-SW-Source: 2002-05/txt/msg00751.txt.bz2 --------------Boundary-00=_XQS9SHHH8P6NSM3R000F Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit Content-length: 1217 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' , 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 * 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. --------------Boundary-00=_XQS9SHHH8P6NSM3R000F Content-Type: text/x-diff; charset="us-ascii"; name="sse_patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sse_patch" Content-length: 4779 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); --------------Boundary-00=_XQS9SHHH8P6NSM3R000F--