[squeak-dev] Re: floats
Eliot Miranda
eliot.miranda at gmail.com
Mon Mar 16 21:47:33 UTC 2009
On Mon, Mar 16, 2009 at 11:41 AM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:
> Hi Eliot,
> AFAIK, VW does not use the nan trick, so it has to perform extra
> conversions on SmallDouble, doesn't it?
That's right. The VW 64-bit immediate double representation is
msb lsb
| 8 bit exponent | 52 bit mantissa | sign | 3 bit tag |
i.e. immediate doubles occupy the middle range of the doubles that
corresponds to single-precision floats, ~ 10-38.
Putting the sign bit down low means that +/- 0 are the only immediate double
values whose bit patterns are <= 15.
Converting an immediate double to an IEEE double then involves
- logical shift right 3 bits (sign is now lsb) - compare against 1 to
distinguish +/- 0 from others
- if > 1 (not +/- 0)
- add exponent offset (maps 8-bit exponent to 11-bit exponent)
- rotate right 1 (move sign to sign bit)
- move integer reg to float reg
Going in the other direction
- move fp reg to integer reg
- rotate left 1 bit (sign is now lsb)
- compare against 1 to distinguish +/- 0 from others
- if > 1 (not +/- 0)
- subtract exponent offset (maps 11-bit exponent to 8-bit
exponent)
- fail if overflow (e.g. jump to code that boxes the float)
- shift left 3
- add tags
So more complicated than immediate integers but of a similar complexity to
the fp unit's internal operations on floats (extracting exponent, shifting
mantissa by exponent).
>
> Nicolas
>
> 2009/3/16 Eliot Miranda <eliot.miranda at gmail.com>
>
>>
>>
>> So the experience with my 64-bit VW implementation was that
>> - typical large symbolic benchmarks (e.g. all senders) were 15% to 20%
>> slower in 64-bits than in 32-bits.
>> - immediate double arithmetic is about 3 times faster at about half
>> the speed of immediate integer operations
>> - images are about 55% larger when converted from 32-bit to 64-bit
>>
>>
>> Eliot
>>
>>
>>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090316/4845cea5/attachment.htm
More information about the Squeak-dev
mailing list
|