s_ceilf.S revision 1.9
11.1Sjtc/*
21.7Ssalo * 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.9SjoergRCSID("$NetBSD: s_ceilf.S,v 1.9 2011/06/18 21:24:51 joerg Exp $")
91.1Sjtc
101.1SjtcENTRY(ceilf)
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	$0x0800,%dx		/* round towards +oo */
191.1Sjtc	andw	$0xfbff,%dx
201.5Sfvdl	movw	%dx,-8(%ebp)
211.5Sfvdl	fldcw	-8(%ebp)		/* load modfied control word */
221.1Sjtc
231.9Sjoerg	flds	8(%ebp)			/* round */
241.1Sjtc	frndint
251.1Sjtc
261.6Sfvdl	fldcw	-4(%ebp)		/* restore original control word */
271.1Sjtc
281.1Sjtc	leave
291.4Sfvdl#else
301.4Sfvdl	fstcw	-8(%rsp)
311.4Sfvdl	movw	-8(%rsp),%dx
321.4Sfvdl	orw	$0x0800,%dx
331.4Sfvdl	andw	$0xfbff,%dx
341.4Sfvdl	movw	%dx,-12(%rsp)
351.4Sfvdl	fldcw	-12(%rsp)
361.4Sfvdl	movss	%xmm0,-4(%rsp)
371.8Sdrochner	flds	-4(%rsp)
381.4Sfvdl	frndint
391.4Sfvdl	fldcw	-8(%rsp)
401.4Sfvdl	fstps	-4(%rsp)
411.4Sfvdl	movss	-4(%rsp),%xmm0
421.4Sfvdl#endif
431.1Sjtc	ret
44