std.math performance (SSE vs. real)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 29 23:21:48 PDT 2014


On 6/29/2014 9:38 PM, Manu via Digitalmars-d wrote:
>> It's news to me that x86, x86-64, etc., are deprecated, despite being used
>> to run pretty much all desktops and laptops and even servers. The 80 bit
>> reals are also part of the C ABI for Linux, OSX, and FreeBSD, 32 and 64 bit.
>
> x86_64 and x86 are different architectures, and they have very different ABI's.
> Nobody is manufacturing x86 (exclusive) cpu's.
> Current x86_64 cpu's maintain a backwards compatibility mode, but
> that's not a part of the x86-64 spec, and may go away when x86_64 is
> deemed sufficiently pervasive and x86 sufficiently redundant.

It's still part of the C ABI for both 32 and 64 bit code.


> Correct, so they are deliberately treated separately.
> I argued for strong separation between simd and float, and you agreed.

floats & doubles are implemented using SIMD instructions.


>> Since they are part of the 64 bit C ABI, that would seem to be in the
>> category of "nevah hoppen".
> Not in windows.

Correct.


> You say they are in linux? I don't know.

Since you don't believe me, I recommend looking it up. The document is entitled 
"System V Application Binary Interface AMD64 Architecture Processor Supplement"

Furthermore, just try using "long double" on Linux, and disassemble the 
resulting code.


> How do you distinguish x87 double and xmm double in C?

You don't. It's a compiler implementation issue.


> The only way I know to access x87 is with inline asm.

I suggest using "long double" on Linux and look at the compiler output. You 
don't have to believe me - use gcc or clang.


> Huh? I think you misunderstood my point. I'm saying that fpu/simd
> units are distinct, and they are distanced by the type system in order
> to respect that separation.

I think that's not correct. There's nothing in the C Standard that says you have 
to implement float semantics with any particular FPU, nor does the C type system 
distinguish FPUs.



More information about the Digitalmars-d mailing list