• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#include <_mingw_mac.h>
7
8	.file	"ceill.S"
9	.text
10#ifdef __x86_64__
11	.align 8
12#else
13	.align 4
14#endif
15	.globl __MINGW_USYMBOL(ceill)
16	.def	__MINGW_USYMBOL(ceill);	.scl	2;	.type	32;	.endef
17__MINGW_USYMBOL(ceill):
18#if defined(_AMD64_) || defined(__x86_64__)
19	fldt	(%rdx)
20	subq	$24,%rsp
21
22	fstcw	8(%rsp)			/* store fpu control word */
23
24	/* We use here %edx although only the low 1 bits are defined.
25	   But none of the operations should care and they are faster
26	   than the 16 bit operations.  */
27	movl	$0x0800,%edx		/* round towards +oo */
28	orl	8(%rsp),%edx
29	andl	$0xfbff,%edx
30	movl	%edx,(%rsp)
31	fldcw	(%rsp)			/* load modified control word */
32
33	frndint				/* round */
34
35	fldcw	8(%rsp)			/* restore original control word */
36
37	addq	$24,%rsp
38	movq	%rcx,%rax
39	movq	$0,8(%rcx)
40	fstpt	(%rcx)
41	ret
42#elif defined(_X86_) || defined(__i386__)
43	fldt	4(%esp)
44	subl	$8,%esp
45	fstcw	4(%esp)
46	movl	$0x0800,%edx
47	orl	4(%esp),%edx
48	andl	$0xfbff,%edx
49	movl	%edx,(%esp)
50	fldcw	(%esp)
51	frndint
52	fldcw	4(%esp)
53	addl $8,%esp
54	ret
55#endif
56