std.math performance (SSE vs. real)
dennis luehring via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 30 09:30:04 PDT 2014
Am 30.06.2014 08:21, schrieb Walter Bright:
>> 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.
gcc.godbolt.org clang 3.4.1 -O3
int main(int argc, char** argv)
{
return ((long double)argc/12345.6789);
}
asm:
.LCPI0_0:
.quad 4668012723080132769 # double 12345.678900000001
main: # @main
movl %edi, -8(%rsp)
fildl -8(%rsp)
fdivl .LCPI0_0(%rip)
fnstcw -10(%rsp)
movw -10(%rsp), %ax
movw $3199, -10(%rsp) # imm = 0xC7F
fldcw -10(%rsp)
movw %ax, -10(%rsp)
fistpl -4(%rsp)
fldcw -10(%rsp)
movl -4(%rsp), %eax
ret
More information about the Digitalmars-d
mailing list