Am 30.06.2014 18:30, schrieb dennis luehring:
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

better this

int main(int argc, char** argv)
{
  return argc * 12345.6789L;
}

.LCPI0_0:
        # x86_fp80 12345.6788999999999996
        .quad   -4546745350290602879

        .short  16396
        .zero   6
main:                                   # @main
        movl    %edi, -8(%rsp)
        fldt    .LCPI0_0(%rip)
        fimull  -8(%rsp)
        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

Reply via email to