More optimized math functions.
This commit is contained in:
parent
b8601deb90
commit
e0e8495b38
@ -1,4 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ARCH_SRCS = e_sqrt.S s_lrint.S s_llrint.S s_remquo.S s_remquof.S
|
||||
ARCH_SRCS = e_sqrt.S e_sqrtf.S s_llrint.S s_llrintf.S s_lrint.S s_lrintf.S \
|
||||
s_remquo.S s_remquof.S s_scalbn.S s_scalbnf.S s_scalbnl.S
|
||||
LDBL_PREC = 64
|
||||
|
32
lib/msun/amd64/e_sqrtf.S
Normal file
32
lib/msun/amd64/e_sqrtf.S
Normal file
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(sqrtf)
|
||||
sqrtss %xmm0, %xmm0
|
||||
ret
|
6
lib/msun/amd64/s_llrintf.S
Normal file
6
lib/msun/amd64/s_llrintf.S
Normal file
@ -0,0 +1,6 @@
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
/* sizeof(long) == sizeof(long long) */
|
||||
#define fn llrintf
|
||||
#include "s_lrintf.S"
|
36
lib/msun/amd64/s_lrintf.S
Normal file
36
lib/msun/amd64/s_lrintf.S
Normal file
@ -0,0 +1,36 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#ifndef fn
|
||||
__FBSDID("$FreeBSD$")
|
||||
#define fn lrintf
|
||||
#endif
|
||||
|
||||
ENTRY(fn)
|
||||
cvtss2si %xmm0, %rax
|
||||
ret
|
39
lib/msun/amd64/s_scalbn.S
Normal file
39
lib/msun/amd64/s_scalbn.S
Normal file
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(scalbn)
|
||||
movsd %xmm0,-8(%rsp)
|
||||
movl %edi,-12(%rsp)
|
||||
fildl -12(%rsp)
|
||||
fldl -8(%rsp)
|
||||
fscale
|
||||
fstp %st(1)
|
||||
fstpl -8(%rsp)
|
||||
movsd -8(%rsp),%xmm0
|
||||
ret
|
39
lib/msun/amd64/s_scalbnf.S
Normal file
39
lib/msun/amd64/s_scalbnf.S
Normal file
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(scalbnf)
|
||||
movss %xmm0,-8(%rsp)
|
||||
movl %edi,-4(%rsp)
|
||||
fildl -4(%rsp)
|
||||
flds -8(%rsp)
|
||||
fscale
|
||||
fstp %st(1)
|
||||
fstps -8(%rsp)
|
||||
movss -8(%rsp),%xmm0
|
||||
ret
|
19
lib/msun/amd64/s_scalbnl.S
Normal file
19
lib/msun/amd64/s_scalbnl.S
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
/* RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
|
||||
|
||||
ENTRY(scalbnl)
|
||||
movl %edi,-4(%rsp)
|
||||
fildl -4(%rsp)
|
||||
fldt 8(%rsp)
|
||||
fscale
|
||||
fstp %st(1)
|
||||
ret
|
||||
|
||||
.globl CNAME(ldexpl)
|
||||
.set CNAME(ldexpl),CNAME(scalbnl)
|
@ -3,14 +3,16 @@
|
||||
ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_log10.S \
|
||||
e_remainder.S e_scalb.S e_sqrt.S s_ceil.S s_copysign.S \
|
||||
s_cos.S s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \
|
||||
s_remquo.S s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S
|
||||
s_remquo.S s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S \
|
||||
s_trunc.S
|
||||
|
||||
# float counterparts
|
||||
ARCH_SRCS+= e_log10f.S e_logf.S e_remainderf.S e_scalbf.S \
|
||||
e_sqrtf.S s_ceilf.S s_copysignf.S s_floorf.S s_logbf.S \
|
||||
s_remquof.S s_rintf.S s_scalbnf.S s_significandf.S
|
||||
e_sqrtf.S s_ceilf.S s_copysignf.S s_floorf.S \
|
||||
s_llrintf.S s_logbf.S s_lrintf.S \
|
||||
s_remquof.S s_rintf.S s_scalbnf.S s_significandf.S s_truncf.S
|
||||
|
||||
# long double counterparts
|
||||
ARCH_SRCS+= s_scalbnl.S
|
||||
ARCH_SRCS+= s_ceill.S s_copysignl.S s_floorl.S s_scalbnl.S s_truncl.S
|
||||
|
||||
LDBL_PREC = 64 # XXX 64-bit format, but truncated to 53 bits
|
||||
|
27
lib/msun/i387/s_ceill.S
Normal file
27
lib/msun/i387/s_ceill.S
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(ceill)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $8,%esp
|
||||
|
||||
fstcw -4(%ebp) /* store fpu control word */
|
||||
movw -4(%ebp),%dx
|
||||
orw $0x0800,%dx /* round towards +oo */
|
||||
andw $0xfbff,%dx
|
||||
movw %dx,-8(%ebp)
|
||||
fldcw -8(%ebp) /* load modfied control word */
|
||||
|
||||
fldt 8(%ebp) /* round */
|
||||
frndint
|
||||
|
||||
fldcw -4(%ebp) /* restore original control word */
|
||||
|
||||
leave
|
||||
ret
|
17
lib/msun/i387/s_copysignl.S
Normal file
17
lib/msun/i387/s_copysignl.S
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(copysignl)
|
||||
movl 24(%esp),%edx
|
||||
andl $0x8000,%edx
|
||||
movl 12(%esp),%eax
|
||||
andl $0x7fff,%eax
|
||||
orl %edx,%eax
|
||||
movl %eax,12(%esp)
|
||||
fldt 4(%esp)
|
||||
ret
|
27
lib/msun/i387/s_floorl.S
Normal file
27
lib/msun/i387/s_floorl.S
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(floorl)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $8,%esp
|
||||
|
||||
fstcw -4(%ebp) /* store fpu control word */
|
||||
movw -4(%ebp),%dx
|
||||
orw $0x0400,%dx /* round towards -oo */
|
||||
andw $0xf7ff,%dx
|
||||
movw %dx,-8(%ebp)
|
||||
fldcw -8(%ebp) /* load modfied control word */
|
||||
|
||||
fldt 8(%ebp) /* round */
|
||||
frndint
|
||||
|
||||
fldcw -4(%ebp) /* restore original control word */
|
||||
|
||||
leave
|
||||
ret
|
36
lib/msun/i387/s_llrintf.S
Normal file
36
lib/msun/i387/s_llrintf.S
Normal file
@ -0,0 +1,36 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(llrintf)
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
fistpll (%esp)
|
||||
popl %eax
|
||||
popl %edx
|
||||
ret
|
35
lib/msun/i387/s_lrintf.S
Normal file
35
lib/msun/i387/s_lrintf.S
Normal file
@ -0,0 +1,35 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(lrintf)
|
||||
flds 4(%esp)
|
||||
subl $4,%esp
|
||||
fistpl (%esp)
|
||||
popl %eax
|
||||
ret
|
26
lib/msun/i387/s_trunc.S
Normal file
26
lib/msun/i387/s_trunc.S
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(trunc)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $8,%esp
|
||||
|
||||
fstcw -4(%ebp) /* store fpu control word */
|
||||
movw -4(%ebp),%dx
|
||||
orw $0x0c00,%dx /* round towards -oo */
|
||||
movw %dx,-8(%ebp)
|
||||
fldcw -8(%ebp) /* load modfied control word */
|
||||
|
||||
fldl 8(%ebp) /* round */
|
||||
frndint
|
||||
|
||||
fldcw -4(%ebp) /* restore original control word */
|
||||
|
||||
leave
|
||||
ret
|
26
lib/msun/i387/s_truncf.S
Normal file
26
lib/msun/i387/s_truncf.S
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(truncf)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $8,%esp
|
||||
|
||||
fstcw -12(%ebp) /* store fpu control word */
|
||||
movw -12(%ebp),%dx
|
||||
orw $0x0c00,%dx /* round towards -oo */
|
||||
movw %dx,-16(%ebp)
|
||||
fldcw -16(%ebp) /* load modfied control word */
|
||||
|
||||
flds 8(%ebp) /* round */
|
||||
frndint
|
||||
|
||||
fldcw -12(%ebp) /* restore original control word */
|
||||
|
||||
leave
|
||||
ret
|
26
lib/msun/i387/s_truncl.S
Normal file
26
lib/msun/i387/s_truncl.S
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(truncl)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $8,%esp
|
||||
|
||||
fstcw -4(%ebp) /* store fpu control word */
|
||||
movw -4(%ebp),%dx
|
||||
orw $0x0c00,%dx /* round towards -oo */
|
||||
movw %dx,-8(%ebp)
|
||||
fldcw -8(%ebp) /* load modfied control word */
|
||||
|
||||
fldt 8(%ebp) /* round */
|
||||
frndint
|
||||
|
||||
fldcw -4(%ebp) /* restore original control word */
|
||||
|
||||
leave
|
||||
ret
|
Loading…
Reference in New Issue
Block a user