s_floorf.S revision 1.6
11.1Sjtc/* 21.6Ssalo * Written by J.T. Conklin <jtc@NetBSD.org>. 31.2Sjtc * Public domain. 41.1Sjtc */ 51.1Sjtc 61.1Sjtc#include <machine/asm.h> 71.1Sjtc 81.6SsaloRCSID("$NetBSD: s_floorf.S,v 1.6 2003/07/26 19:25:02 salo Exp $") 91.1Sjtc 101.1SjtcENTRY(floorf) 111.4Sfvdl#ifdef __i386__ 121.1Sjtc pushl %ebp 131.1Sjtc movl %esp,%ebp 141.1Sjtc subl $8,%esp 151.1Sjtc 161.5Sfvdl fstcw -4(%ebp) /* store fpu control word */ 171.5Sfvdl movw -4(%ebp),%dx 181.1Sjtc orw $0x0400,%dx /* round towards -oo */ 191.1Sjtc andw $0xf7ff,%dx 201.5Sfvdl movw %dx,-8(%ebp) 211.5Sfvdl fldcw -8(%ebp) /* load modfied control word */ 221.1Sjtc 231.1Sjtc flds 8(%ebp); /* round */ 241.1Sjtc frndint 251.1Sjtc 261.5Sfvdl fldcw -4(%ebp) /* restore original control word */ 271.1Sjtc 281.1Sjtc leave 291.4Sfvdl#else 301.4Sfvdl movss %xmm0, -4(%rsp) 311.4Sfvdl fstcw -8(%rsp) 321.4Sfvdl movw -8(%rsp),%dx 331.4Sfvdl orw $0x0400,%dx 341.4Sfvdl andw $0xf7ff,%dx 351.4Sfvdl movw %dx,-12(%rsp) 361.4Sfvdl fldcw -12(%rsp) 371.4Sfvdl fldl -4(%rsp) 381.4Sfvdl frndint 391.4Sfvdl fldcw -8(%rsp) 401.4Sfvdl fstpl -4(%rsp) 411.4Sfvdl movss -4(%rsp),%xmm0 421.4Sfvdl#endif 431.1Sjtc ret 44