Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* ARM float/double conversion
@ 2001-12-05  6:54 Timothy Wall
  2001-12-05  8:05 ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy Wall @ 2001-12-05  6:54 UTC (permalink / raw)
  To: gdb

In gdb/doublest.c, there is some conversion done for
floatformat_littlebyte_bigword (currently only used by ARM):

          longswaps = fmt->totalsize / FLOATFORMAT_CHAR_BIT;
          longswaps >>= 3;

          while (longswaps-- > 0)
            {
              /* This is ugly, but efficient */
              *swapout++ = swapin[4];
              *swapout++ = swapin[5];
              *swapout++ = swapin[6];
              *swapout++ = swapin[7];
              *swapout++ = swapin[0];
              *swapout++ = swapin[1];
              *swapout++ = swapin[2];
              *swapout++ = swapin[3];
              swapin += 8;
            }

What's odd is that fmt->totalsize can be either 64 or 96, based on the formats
defined in libiberty/floatformat.c.  For either case, longswaps will be 1, so
I don't understand why
this code was "generalized".  I assume that the extended double on the ARM has
just the
first two 32-bit words swapped.

I actually need to extend this code to do similar swaps for a 32-bit float,
and was going to
"generalize" to accommodate that (little-endian, bigword, word size is 16
bits).

T.


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

* Re: ARM float/double conversion
  2001-12-05  6:54 ARM float/double conversion Timothy Wall
@ 2001-12-05  8:05 ` Andrew Cagney
  2001-12-05  8:16   ` Richard Earnshaw
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-12-05  8:05 UTC (permalink / raw)
  To: twall; +Cc: gdb

> In gdb/doublest.c, there is some conversion done for
> floatformat_littlebyte_bigword (currently only used by ARM):
> 
>           longswaps = fmt->totalsize / FLOATFORMAT_CHAR_BIT;
>           longswaps >>= 3;
> 
>           while (longswaps-- > 0)
>             {
>               /* This is ugly, but efficient */
>               *swapout++ = swapin[4];
>               *swapout++ = swapin[5];
>               *swapout++ = swapin[6];
>               *swapout++ = swapin[7];
>               *swapout++ = swapin[0];
>               *swapout++ = swapin[1];
>               *swapout++ = swapin[2];
>               *swapout++ = swapin[3];
>               swapin += 8;
>             }
> 
> What's odd is that fmt->totalsize can be either 64 or 96, based on the formats
> defined in libiberty/floatformat.c.  For either case, longswaps will be 1, so
> I don't understand why
> this code was "generalized".  I assume that the extended double on the ARM has
> just the
> first two 32-bit words swapped.

No.  I'm pretty sure the hardware engineers wouldn't have done that. I 
suspect instead that this is a long standing problem with cross 
debugging the Arm.  Anyone got an Arm spec available - my Arm book 
suggests the above is wrong but isn't 100% clear?

	Andrew



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

* Re: ARM float/double conversion
  2001-12-05  8:05 ` Andrew Cagney
@ 2001-12-05  8:16   ` Richard Earnshaw
  2001-12-05  9:36     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Earnshaw @ 2001-12-05  8:16 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: twall, gdb, Richard.Earnshaw

 Anyone got an Arm spec available - my Arm book 
> suggests the above is wrong but isn't 100% clear?
> 
> 	Andrew
> 
> 
I think you want chapter 8 of the following:

http://www.arm.com/armwww.ns4/img/12-Tech+Ref+Manuals-ARM7500FE+PDF/$File/ARM7500FEvB.pdf?OpenElement


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

* Re: ARM float/double conversion
  2001-12-05  8:16   ` Richard Earnshaw
@ 2001-12-05  9:36     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2001-12-05  9:36 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: twall, gdb

> I think you want chapter 8 of the following:

Hmm, it is very like my Arm book :-)  Reading a combination of chapter's 
4 (byte order) and 8 FP format is what makes me think that code is wrong.

The Arm only swaps within a 4 byte word.

	Andrew



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

end of thread, other threads:[~2001-12-05 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-05  6:54 ARM float/double conversion Timothy Wall
2001-12-05  8:05 ` Andrew Cagney
2001-12-05  8:16   ` Richard Earnshaw
2001-12-05  9:36     ` Andrew Cagney

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