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	"log10l.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	.text
22#ifdef __x86_64__
23	.align 8
24#else
25	.align 4
26#endif
27.globl __MINGW_USYMBOL(log10l)
28	.def	__MINGW_USYMBOL(log10l);	.scl	2;	.type	32;	.endef
29__MINGW_USYMBOL(log10l):
30#ifdef __x86_64__
31	fldlg2			// log10(2)
32	fldt	(%rdx)		// x : log10(2)
33	fxam
34	fnstsw
35	fld	%st		// x : x : log10(2)
36	sahf
37	jc	3f		// in case x is NaN or Inf
384:	fsubl	one(%rip)	// x-1 : x : log10(2)
39	fld	%st		// x-1 : x-1 : x : log10(2)
40	fabs			// |x-1| : x-1 : x : log10(2)
41	fcompl	limit(%rip)	// x-1 : x : log10(2)
42	fnstsw			// x-1 : x : log10(2)
43	andb	$0x45, %ah
44	jz	2f
45	fstp	%st(1)		// x-1 : log10(2)
46	fyl2xp1			// log10(x)
47	movq	%rcx,%rax
48	movq	$0,8(%rcx)
49	fstpt	(%rcx)
50	ret
51
522:	fstp	%st(0)		// x : log10(2)
53	fyl2x			// log10(x)
54	movq	%rcx,%rax
55	movq	$0,8(%rcx)
56	fstpt	(%rcx)
57	ret
58
593:	jp	4b		// in case x is Inf
60	fstp	%st(1)
61	fstp	%st(1)
62	movq	%rcx,%rax
63	movq	$0,8(%rcx)
64	fstpt	(%rcx)
65	ret
66#else
67	fldlg2			// log10(2)
68	fldt	4(%esp)		// x : log10(2)
69	fxam
70	fnstsw
71	fld	%st		// x : x : log10(2)
72	sahf
73	jc	3f		// in case x is NaN or Inf
744:	fsubl	one		// x-1 : x : log10(2)
75	fld	%st		// x-1 : x-1 : x : log10(2)
76	fabs			// |x-1| : x-1 : x : log10(2)
77	fcompl	limit		// x-1 : x : log10(2)
78	fnstsw			// x-1 : x : log10(2)
79	andb	$0x45, %ah
80	jz	2f
81	fstp	%st(1)		// x-1 : log10(2)
82	fyl2xp1			// log10(x)
83	ret
84
852:	fstp	%st(0)		// x : log10(2)
86	fyl2x			// log10(x)
87	ret
88
893:	jp	4b		// in case x is Inf
90	fstp	%st(1)
91	fstp	%st(1)
92	ret
93#endif