Blame sysdeps/x86_64/fpu/s_floorl.S

Packit 6c4009
/*
Packit 6c4009
 * Written by J.T. Conklin <jtc@netbsd.org>.
Packit 6c4009
 * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
Packit 6c4009
 * Changes for x86-64 by Andreas Jaeger <aj@suse.de>=09
Packit 6c4009
 * Public domain.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <libm-alias-ldouble.h>
Packit 6c4009
#include <machine/asm.h>
Packit 6c4009
Packit 6c4009
ENTRY(__floorl)
Packit 6c4009
	fldt	8(%rsp)
Packit 6c4009
Packit 6c4009
	fnstenv	-28(%rsp)		/* store fpu environment */
Packit 6c4009
Packit 6c4009
	/* We use here %edx although only the low 1 bits are defined.
Packit 6c4009
	   But none of the operations should care and they are faster
Packit 6c4009
	   than the 16 bit operations.  */
Packit 6c4009
	movl	$0x400,%edx		/* round towards -oo */
Packit 6c4009
	orl	-28(%rsp),%edx
Packit 6c4009
	andl	$0xf7ff,%edx
Packit 6c4009
	movl	%edx,-32(%rsp)
Packit 6c4009
	fldcw	-32(%rsp)		/* load modified control word */
Packit 6c4009
Packit 6c4009
	frndint				/* round */
Packit 6c4009
Packit 6c4009
	/* Preserve "invalid" exceptions from sNaN input.  */
Packit 6c4009
	fnstsw
Packit 6c4009
	andl	$0x1, %eax
Packit 6c4009
	orl	%eax, -24(%rsp)
Packit 6c4009
Packit 6c4009
	fldenv	-28(%rsp)		/* restore original environment */
Packit 6c4009
Packit 6c4009
	ret
Packit 6c4009
END (__floorl)
Packit 6c4009
libm_alias_ldouble (__floor, floor)