This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rint/nearbyint for x86-64


__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*
  ...
-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]