Always false float comparisons
Max Samukha via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 16 04:27:17 PDT 2016
On Monday, 16 May 2016 at 10:25:33 UTC, Andrei Alexandrescu wrote:
> On 5/16/16 12:37 AM, Walter Bright wrote:
>> Me, I think of that as "Who cares that you paid $$$ for an 80
>> bit CPU,
>> we're going to give you only 64 bits."
>
> I'm not sure about this. My understanding is that all SSE has
> hardware for 32 and 64 bit floats, and the the 80-bit hardware
> is pretty much cut-and-pasted from the x87 days without anyone
> really looking in improving it. And that's been the case for
> more than a decade. Is that correct?
>
> I'm looking for example at
> http://nicolas.limare.net/pro/notes/2014/12/12_arit_speed/ and
> see that on all Intel and compatible hardware, the speed of
> 80-bit floating point operations ranges between much slower and
> disastrously slower.
>
> I think it's time to revisit our attitudes to floating point,
> which was formed last century in the heydays of x87. My
> perception is the world has moved to SSE and 32- and 64-bit
> float; the "real" type is a distraction for D; the whole let's
> do things in 128-bit during compilation is a time waster; and
> many of the original things we want to do with floating point
> are different without a distinction, and a further waste of our
> resources.
>
> It is a bit ironic that we worry about autodecoding (I'll
> destroy that later) whilst a landslide loss of speed and
> predictability in floating point math doesn't raise an eyebrow.
>
>
> Andrei
The AMD64 programmer's manual discourages the use of x87:
"For media and scientific programs that demand floating-point
operations, it is often easier and more
powerful to use SSE instructions. Such programs perform better
than x87 floating-point programs,
because the YMM/XMM register file is flat rather than
stack-oriented, there are twice as many
registers (in 64-bit mode), and SSE instructions can operate on
four or eight times the number of
floating-point operands as can x87 instructions. This ability to
operate in parallel on multiple pairs of
floating-point elements often makes it possible to remove local
temporary variables that would
otherwise be needed in x87 floating-point code."
More information about the Digitalmars-d
mailing list