This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: rint/nearbyint for x86-64
- From: John Reiser <jreiser at BitWagon dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 12 Mar 2008 10:36:53 -0700
- Subject: Re: rint/nearbyint for x86-64
- References: <47D811CE.6020503@BitWagon.com>
__rint forgot to isolate the sign of the scalar:
> ENTRY(__rint)
> movmskpd %xmm0,%eax // extract packed signs to low 2 bits of eax
> stmxcsr -4(%rsp); movl -4(%rsp),%ecx // original mxcsr
> lea two52p(%rip),%rdx // no double index with %rip as base
> andl $~(1<<P_PRECISION_MASK),-4(%rsp)
and $1,%eax // sign of scalar in xmm0
> ldmxcsr -4(%rsp) // enable Precision exception
> add %eax,%eax // 2*
...
--