diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-08 17:29:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-08 17:29:40 +0000 |
commit | fb76d2f5c3482bf6f14ea8c36be524996a5a62f1 (patch) | |
tree | 91ec5d61d47b4def687353fb69fcda0fec2ac9dd /lib | |
parent | 09f69de401312eca0df56bf50d0efe68ef2cbf39 (diff) |
from freebsd (and appears to make our awk work better)
Tidy up modf.S and make it actually work. It wasn't extracting
the value out of ST(0) before copying it to %xmm0. Also remove bogus stack
frame and work in the red zone.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/amd64/gen/modf.S | 31 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/gen/modf.S | 31 |
2 files changed, 28 insertions, 34 deletions
diff --git a/lib/libc/arch/amd64/gen/modf.S b/lib/libc/arch/amd64/gen/modf.S index 9e6c13b3cb4..44ef74ab668 100644 --- a/lib/libc/arch/amd64/gen/modf.S +++ b/lib/libc/arch/amd64/gen/modf.S @@ -1,4 +1,4 @@ -/* $OpenBSD: modf.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $OpenBSD: modf.S,v 1.2 2004/02/08 17:29:39 deraadt Exp $ */ /* $NetBSD: modf.S,v 1.1 2001/06/19 00:25:03 fvdl Exp $ */ /*- @@ -51,44 +51,41 @@ /* With CHOP mode on, frndint behaves as TRUNC does. Useful. */ ENTRY(modf) - pushq %rbp - movq %rsp,%rbp - subq $24,%rsp /* * Set chop mode. */ - fnstcw -12(%rbp) - movw -12(%rbp),%dx + fnstcw -12(%rsp) + movw -12(%rsp),%dx orw $3072,%dx - movw %dx,-16(%rbp) - fldcw -16(%rbp) + movw %dx,-16(%rsp) + fldcw -16(%rsp) /* * Get integral part. */ - movsd %xmm0,-24(%rbp) - fldl -24(%rbp) + movsd %xmm0,-24(%rsp) + fldl -24(%rsp) frndint - fstpl -8(%rbp) + fstpl -8(%rsp) /* * Restore control word. */ - fldcw -12(%rbp) + fldcw -12(%rsp) /* * Store integral part. */ - movsd -8(%rbp),%xmm0 + movsd -8(%rsp),%xmm0 movsd %xmm0,(%rdi) /* * Get fractional part and return it. */ - fldl -24(%rbp) - fsubl -8(%rbp) - movsd -8(%rbp),%xmm0 + fldl -24(%rsp) + fsubl -8(%rsp) + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 - leave ret diff --git a/lib/libc/arch/x86_64/gen/modf.S b/lib/libc/arch/x86_64/gen/modf.S index 9e6c13b3cb4..44ef74ab668 100644 --- a/lib/libc/arch/x86_64/gen/modf.S +++ b/lib/libc/arch/x86_64/gen/modf.S @@ -1,4 +1,4 @@ -/* $OpenBSD: modf.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $OpenBSD: modf.S,v 1.2 2004/02/08 17:29:39 deraadt Exp $ */ /* $NetBSD: modf.S,v 1.1 2001/06/19 00:25:03 fvdl Exp $ */ /*- @@ -51,44 +51,41 @@ /* With CHOP mode on, frndint behaves as TRUNC does. Useful. */ ENTRY(modf) - pushq %rbp - movq %rsp,%rbp - subq $24,%rsp /* * Set chop mode. */ - fnstcw -12(%rbp) - movw -12(%rbp),%dx + fnstcw -12(%rsp) + movw -12(%rsp),%dx orw $3072,%dx - movw %dx,-16(%rbp) - fldcw -16(%rbp) + movw %dx,-16(%rsp) + fldcw -16(%rsp) /* * Get integral part. */ - movsd %xmm0,-24(%rbp) - fldl -24(%rbp) + movsd %xmm0,-24(%rsp) + fldl -24(%rsp) frndint - fstpl -8(%rbp) + fstpl -8(%rsp) /* * Restore control word. */ - fldcw -12(%rbp) + fldcw -12(%rsp) /* * Store integral part. */ - movsd -8(%rbp),%xmm0 + movsd -8(%rsp),%xmm0 movsd %xmm0,(%rdi) /* * Get fractional part and return it. */ - fldl -24(%rbp) - fsubl -8(%rbp) - movsd -8(%rbp),%xmm0 + fldl -24(%rsp) + fsubl -8(%rsp) + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 - leave ret |