summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-05-08 03:19:37 +0000
committerpeter <peter@FreeBSD.org>2003-05-08 03:19:37 +0000
commit223b5925cfbbd74c7919b70438cc20deecdc6514 (patch)
tree56ecae4d1a4cabccb358a3b9369ca7efde616867
parentc47ebbd98f7167ae78a7885c1afa61c6439b5f90 (diff)
downloadFreeBSD-src-223b5925cfbbd74c7919b70438cc20deecdc6514.zip
FreeBSD-src-223b5925cfbbd74c7919b70438cc20deecdc6514.tar.gz
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.
-rw-r--r--lib/libc/amd64/gen/modf.S29
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/libc/amd64/gen/modf.S b/lib/libc/amd64/gen/modf.S
index 2c25b77..d448de1 100644
--- a/lib/libc/amd64/gen/modf.S
+++ b/lib/libc/amd64/gen/modf.S
@@ -52,44 +52,41 @@ __FBSDID("$FreeBSD$");
/* 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
OpenPOWER on IntegriCloud