• 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	"log1p.S"
9	.text
10#ifdef __x86_64__
11	.align 8
12#else
13	.align 4
14#endif
15	/* The fyl2xp1 can only be used for values in
16	   -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
17	   0.29 is a safe value.
18	 */
19limit:	.double 0.29
20one:	.double 1.0
21/*
22 * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
23 * otherwise fyl2x with the needed extra computation.
24 */
25.globl __MINGW_USYMBOL(log1p)
26	.def	__MINGW_USYMBOL(log1p);	.scl	2;	.type	32;	.endef
27__MINGW_USYMBOL(log1p):
28#ifdef __x86_64__
29	movsd	%xmm0,-16(%rsp)
30	fldln2
31	fldl	-16(%rsp)
32	fxam
33	fnstsw
34	fld	%st
35	sahf
36	jc	3f	// in case x is NaN or �Inf
37
384:	fabs
39	fcompl	limit(%rip)
40	fnstsw
41	sahf
42	jc	2f
43	faddl	one(%rip)
44	fyl2x
45	fstpl	-16(%rsp)
46	movsd	-16(%rsp),%xmm0
47	ret
48
492:	fyl2xp1
50	fstpl	-16(%rsp)
51	movsd	-16(%rsp),%xmm0
52	ret
53
543:	jp	4b	// in case x is �Inf
55	fstp	%st(1)
56	fstp	%st(1)
57	fstpl	-16(%rsp)
58	movsd	-16(%rsp),%xmm0
59	ret
60#else
61	fldln2
62	fldl	4(%esp)
63	fxam
64	fnstsw
65	fld	%st
66	sahf
67	jc	3f	// in case x is NaN or �Inf
68
694:	fabs
70	fcompl	limit
71	fnstsw
72	sahf
73	jc	2f
74	faddl	one
75	fyl2x
76	ret
77
782:	fyl2xp1
79	ret
80
813:	jp	4b	// in case x is �Inf
82	fstp	%st(1)
83	fstp	%st(1)
84	ret
85#endif
86