xref: /openbsd/lib/libm/arch/amd64/s_ceil.S (revision 5af055cd)
1/*	$OpenBSD: s_ceil.S,v 1.3 2009/04/08 22:30:41 martynas Exp $ */
2/*
3 * Written by J.T. Conklin <jtc@NetBSD.org>.
4 * Public domain.
5 */
6
7#include <machine/asm.h>
8
9#include "abi.h"
10
11ENTRY(ceil)
12	fstcw	-12(%rsp)
13	movw	-12(%rsp),%dx
14	orw	$0x0800,%dx
15	andw	$0xfbff,%dx
16	movw	%dx,-16(%rsp)
17	fldcw	-16(%rsp)
18	movsd	%xmm0,-8(%rsp)
19	fldl	-8(%rsp)
20	frndint
21	fldcw	-12(%rsp)
22	fstpl	-8(%rsp)
23	movsd	-8(%rsp),%xmm0
24	ret
25