1/*
2 * Public domain.
3 */
4
5#include <libm-alias-ldouble.h>
6#include <machine/asm.h>
7
8
9ENTRY(__ceill)
10 fldt 8(%rsp)
11
12 fnstenv -28(%rsp) /* store fpu environment */
13
14 /* We use here %edx although only the low 1 bits are defined.
15 But none of the operations should care and they are faster
16 than the 16 bit operations. */
17 movl $0x0800,%edx /* round towards +oo */
18 orl -28(%rsp),%edx
19 andl $0xfbff,%edx
20 movl %edx,-32(%rsp)
21 fldcw -32(%rsp) /* load modified control word */
22
23 frndint /* round */
24
25 /* Preserve "invalid" exceptions from sNaN input. */
26 fnstsw
27 andl $0x1, %eax
28 orl %eax, -24(%rsp)
29
30 fldenv -28(%rsp) /* restore original environment */
31
32 ret
33END (__ceill)
34libm_alias_ldouble (__ceil, ceil)
35

source code of glibc/sysdeps/x86_64/fpu/s_ceill.S