1/* $OpenBSD: s_floor.S,v 1.3 2005/08/02 11:17:31 espie Exp $ */ 2/* 3 * Written by J.T. Conklin <jtc@netbsd.org>. 4 * Public domain. 5 */ 6 7#include <machine/asm.h> 8 9ENTRY(floor) 10 subl $8,%esp 11 12 fstcw 4(%esp) /* store fpu control word */ 13 movw 4(%esp),%dx 14 orw $0x0400,%dx /* round towards -oo */ 15 andw $0xf7ff,%dx 16 movw %dx,(%esp) 17 fldcw (%esp) /* load modfied control word */ 18 19 fldl 12(%esp); /* round */ 20 frndint 21 22 fldcw 4(%esp) /* restore original control word */ 23 24 addl $8,%esp 25 ret 26