Re: [PATCH] PPC - Printing Decimal 128 types out of registers

Luis Machado
2007-11-26T21:40:33Z

Hi there,

Did anyone have a chance to go through this one?

Regards,
Luis

On Wed, 2007-11-07 at 16:33 -0200, Luis Machado wrote:
> Hi folks,
>
> I'm continuing the work to enhance DFP type support on GDB. DFP types
> are nativelly supported on the Power6 processor, thus they are stored in
> registers as so. This patch handles the printing and setting of
> Decimal128 types directly out of/in the registers.
>
> A Decimal128 type is stored using pairs of Floating Point registers, and
> it always starts in an even-numbered register. So, we could, for
> example, have a Decimal128 var taking up FPR0-FPR1, FPR10-FPR11, but
> never FPR1-FPR2 or FPR23-24.
>
> Right now GDB isn't able to print those vars as it doesn't know they
> take up more than one register.
>
> The idea to overcome this was to create a new set of 16 Decimal128-typed
> pseudo-registers called DL (Standing for "D"ecimal "L"ong Double) that
> would represent all 16 pairs of Floating Point Registers.. By using a
> pseudo-register mechanism, we're able to force the DL/FPR registers to
> map directly into the FPR/DL registers.
>
> Benefits of this change include:
>
> * Better printing support for Decimal128 types. We just print the
> register as is. No need to include casting tricks and arrays to print
> that value.
>
> * Straightforward way of setting Decimal128 values directly in the
> registers. We just "set $dl0=1.23dl", for example, and it's
> automatically set.
>
> * Overview of the state of 16 Decimal128 registers using the "info reg
> all" command.
>
>
> Supporting the patch there is also a number of other modifications, as
> listed:
>
> * DFP types are now global since they were included as predefined types
> in the "target-descriptions.c" file.
>
> * A simple testcase making sure the registers are working as expected.
>
> * Piece of documentation for the GDB manual.
>
> * Fix to display a 128-bit hex literal representation of Decimal128
> types (using "info reg").
>
> Also note that this support will be available for both ppc64 and ppc32.
>
> Looking forward to have comments and suggestions for improvements.
>
> Regards,
> Luis
--
Luis Machado
IBM Linux Technology Center
e-mail: luisgpm@linux.vnet.ibm.com