master
 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	"internal_logl.S"
 9	.text
10#ifdef __x86_64__
11	.align 8
12#else
13	.align 4
14#endif
15one:	.double 1.0
16	/* It is not important that this constant is precise.  It is only
17	   a value which is known to be on the safe side for using the
18	   fyl2xp1 instruction.  */
19limit:	.double 0.29
20
21.globl __MINGW_USYMBOL(__logl_internal)
22	.def	__MINGW_USYMBOL(__logl_internal);	.scl	2;	.type	32;	.endef
23__MINGW_USYMBOL(__logl_internal):
24#ifdef __x86_64__
25	fldln2			// log(2)
26	fldt	(%rdx)		// x : log(2)
27	fld	%st		// x : x : log(2)
28	fsubl	one(%rip)	// x-1 : x : log(2)
29	fld	%st		// x-1 : x-1 : x : log(2)
30	fabs			// |x-1| : x-1 : x : log(2)
31	fcompl	limit(%rip)	// x-1 : x : log(2)
32	fnstsw			// x-1 : x : log(2)
33	andb	$0x45, %ah
34	jz	2f
35	fstp	%st(1)		// x-1 : log(2)
36	fyl2xp1			// log(x)
37	movq	%rcx,%rax
38	movq	$0,8(%rcx)
39	fstpt	(%rcx)
40	ret
41
422:	fstp	%st(0)		// x : log(2)
43	fyl2x			// log(x)
44	movq	%rcx,%rax
45	movq	$0,8(%rcx)
46	fstpt	(%rcx)
47	ret
48#else
49	fldln2			// log(2)
50	fldt	4(%esp)		// x : log(2)
51	fld	%st		// x : x : log(2)
52	fsubl	one		// x-1 : x : log(2)
53	fld	%st		// x-1 : x-1 : x : log(2)
54	fabs			// |x-1| : x-1 : x : log(2)
55	fcompl	limit		// x-1 : x : log(2)
56	fnstsw			// x-1 : x : log(2)
57	andb	$0x45, %ah
58	jz	2f
59	fstp	%st(1)		// x-1 : log(2)
60	fyl2xp1			// log(x)
61	ret
62
632:	fstp	%st(0)		// x : log(2)
64	fyl2x			// log(x)
65	ret
66#endif