• 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	"floorl.S"
9	.text
10#ifdef __x86_64__
11	.align 8
12#else
13	.align 4
14#endif
15	.globl __MINGW_USYMBOL(floorl)
16	.def	__MINGW_USYMBOL(floorl);	.scl	2;	.type	32;	.endef
17__MINGW_USYMBOL(floorl):
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	$0x400,%edx		/* round towards -oo */
28	orl	8(%rsp),%edx
29	andl	$0xf7ff,%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
46	fstcw	4(%esp)			/* store fpu control word */
47
48	/* We use here %edx although only the low 1 bits are defined.
49	   But none of the operations should care and they are faster
50	   than the 16 bit operations.  */
51	movl	$0x400,%edx		/* round towards -oo */
52	orl	4(%esp),%edx
53	andl	$0xf7ff,%edx
54	movl	%edx,(%esp)
55	fldcw	(%esp)			/* load modified control word */
56
57	frndint				/* round */
58
59	fldcw	4(%esp)			/* restore original control word */
60
61	addl	$8,%esp
62	ret
63#endif
64