Blame sysdeps/i386/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
 * Public domain.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <libm-alias-ldouble.h>
Packit 6c4009
#include <machine/asm.h>
Packit 6c4009
Packit 6c4009
RCSID("$NetBSD: $")
Packit 6c4009
Packit 6c4009
ENTRY(__floorl)
Packit 6c4009
	fldt	4(%esp)
Packit 6c4009
	subl	$32,%esp
Packit 6c4009
	cfi_adjust_cfa_offset (32)
Packit 6c4009
Packit 6c4009
	fnstenv	4(%esp)			/* 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	4(%esp),%edx
Packit 6c4009
	andl	$0xf7ff,%edx
Packit 6c4009
	movl	%edx,(%esp)
Packit 6c4009
	fldcw	(%esp)			/* 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, 8(%esp)
Packit 6c4009
Packit 6c4009
	fldenv	4(%esp)			/* restore original environment */
Packit 6c4009
Packit 6c4009
	addl	$32,%esp
Packit 6c4009
	cfi_adjust_cfa_offset (-32)
Packit 6c4009
	ret
Packit 6c4009
END (__floorl)
Packit 6c4009
libm_alias_ldouble (__floor, floor)