fix calling convention on win64, mostly passing the numerical tests

This commit is contained in:
Jameson Nash 2013-07-11 20:19:52 -04:00
parent bb082aca5d
commit 0cd232d8cf
16 changed files with 107 additions and 18 deletions

View file

@ -9,13 +9,23 @@
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainderl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(remainderl)
#ifndef _WIN64
fldt 24(%rsp)
fldt 8(%rsp)
#else
fldt (%r8)
fldt (%rdx)
#endif
1: fprem1
fstsw %ax
testw $0x400,%ax
jne 1b
fstp %st(1)
#ifdef _WIN64
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret

View file

@ -28,8 +28,15 @@
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrtl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(sqrtl)
#ifndef _WIN64
fldt 8(%rsp)
fsqrt
#else
fldt (%rdx)
fsqrt
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret

View file

@ -1,6 +1,8 @@
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrint.S,v 1.3 2011/02/04 21:54:06 kib Exp $")
/* sizeof(long) == sizeof(long long) */
#define fn llrint
#include "s_lrint.S"
ENTRY(llrint)
cvtsd2si %xmm0, %rax
ret
END(llrint)

View file

@ -1,6 +1,8 @@
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrintf.S,v 1.3 2011/02/04 21:54:06 kib Exp $")
/* sizeof(long) == sizeof(long long) */
#define fn llrintf
#include "s_lrintf.S"
ENTRY(llrintf)
cvtss2si %xmm0, %rax
ret
END(llrintf)

View file

@ -28,10 +28,14 @@
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(llrintl)
#ifndef _WIN64
fldt 8(%rsp)
#else
fldt (%rcx)
#endif
subq $8,%rsp
fistpll (%rsp)
popq %rax
ret

View file

@ -8,9 +8,18 @@
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_logbl.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
ENTRY(logbl)
#ifndef _WIN64
fldt 8(%rsp)
#else
fldt (%rdx)
#endif
fxtract
fstp %st
#ifdef _WIN64
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret

View file

@ -26,14 +26,15 @@
#include <amd64/bsd_asm.h>
#ifndef fn
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
#define fn lrint
#endif
ENTRY(fn)
ENTRY(lrint)
#ifndef _WIN64
cvtsd2si %xmm0, %rax
#else
cvtsd2si %xmm0, %eax
#endif
ret
END(fn)
END(lrint)

View file

@ -26,14 +26,15 @@
#include <amd64/bsd_asm.h>
#ifndef fn
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
#define fn lrintf
#endif
ENTRY(fn)
ENTRY(lrintf)
#ifndef _WIN64
cvtss2si %xmm0, %rax
#else
cvtss2si %xmm0, %eax
#endif
ret
END(fn)
END(lrintf)

View file

@ -28,7 +28,11 @@
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(lrintl)
#ifndef _WIN64
fldt 8(%rsp)
#else
fldt (%rcx)
#endif
subq $8,%rsp
fistpll (%rsp)
popq %rax

View file

@ -59,7 +59,11 @@ ENTRY(remquo)
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
#ifndef _WIN64
movl %eax,(%rdi)
#else
movl %eax,(%r8)
#endif
fstpl -8(%rsp)
movsd -8(%rsp),%xmm0
ret

View file

@ -59,7 +59,11 @@ ENTRY(remquof)
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
#ifndef _WIN64
movl %eax,(%rdi)
#else
movl %eax,(%r8)
#endif
fstps -4(%rsp)
movss -4(%rsp),%xmm0
ret

View file

@ -32,8 +32,14 @@
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquol.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquol)
#ifndef _WIN64
fldt 24(%rsp)
fldt 8(%rsp)
#else
fldt (%r8)
fldt (%rdx)
mov %rcx,%r8
#endif
1: fprem1
fstsw %ax
btw $10,%ax
@ -58,7 +64,14 @@ ENTRY(remquol)
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
#ifndef _WIN64
movl %eax,(%rdi)
#else
movl %eax,(%r9)
mov %r8,%rax
movq $0x0,0x8(%r8)
fstpt (%r8)
#endif
ret

View file

@ -7,8 +7,16 @@
#include <amd64/bsd_asm.h>
ENTRY(rintl)
#ifndef _WIN64
fldt 8(%rsp)
frndint
#else
fldt (%rdx)
frndint
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret

View file

@ -29,7 +29,11 @@
ENTRY(scalbn)
movsd %xmm0,-8(%rsp)
#ifndef _WIN64
movl %edi,-12(%rsp)
#else
movl %edx,-12(%rsp)
#endif
fildl -12(%rsp)
fldl -8(%rsp)
fscale

View file

@ -29,7 +29,11 @@
ENTRY(scalbnf)
movss %xmm0,-8(%rsp)
#ifndef _WIN64
movl %edi,-4(%rsp)
#else
movl %edx,-4(%rsp)
#endif
fildl -4(%rsp)
flds -8(%rsp)
fscale

View file

@ -8,11 +8,23 @@
/* //RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
ENTRY(scalbnl)
#ifndef _WIN64
movl %edi,-4(%rsp)
fildl -4(%rsp)
fldt 8(%rsp)
#else
mov %r8,%rax
movl %eax,-4(%rsp)
fildl -4(%rsp)
fldt (%rdx)
#endif
fscale
fstp %st(1)
#ifdef _WIN64
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret
END(scalbnl)