Blame sysdeps/i386/fpu/s_floorf.S

Packit 6c4009
/*
Packit 6c4009
 * Written by J.T. Conklin <jtc@netbsd.org>.
Packit 6c4009
 * Public domain.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <machine/asm.h>
Packit 6c4009
#include <libm-alias-float.h>
Packit 6c4009
Packit 6c4009
RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $")
Packit 6c4009
Packit 6c4009
ENTRY(__floorf)
Packit 6c4009
	flds	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
	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 (__floorf)
Packit 6c4009
libm_alias_float (__floor, floor)