• 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	"log1pl.S"
9	.text
10	/* The fyl2xp1 can only be used for values in
11	   -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
12	   0.29 is a safe value.
13	 */
14
15	/* Only gcc understands the .tfloat type
16	   The series of .long below represents
17	   limit:	.tfloat 0.29
18	 */
19	.align 16
20limit:
21	.long 2920577761
22	.long 2491081031
23	.long 16381
24#ifdef __x86_64__
25	.align 8
26#else
27	.align 4
28#endif
29	/* Please note:	 we use a double value here.  Since 1.0 has
30	   an exact representation this does not effect the accuracy
31	   but it helps to optimize the code.  */
32one:	.double 1.0
33
34/*
35 * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
36 * otherwise fyl2x with the needed extra computation.
37 */
38.globl __MINGW_USYMBOL(log1pl)
39	.def	__MINGW_USYMBOL(log1pl);	.scl	2;	.type	32;	.endef
40__MINGW_USYMBOL(log1pl):
41#ifdef __x86_64__
42	fldln2
43	fldt	(%rdx)
44	fxam
45	fnstsw
46	fld	%st
47	sahf
48	jc	3f		// in case x is NaN or �Inf
494:
50	fabs
51	fldt	limit(%rip)
52	fcompp
53	fnstsw
54	sahf
55	jnc	2f
56	faddl	one(%rip)
57	fyl2x
58	movq	%rcx,%rax
59	movq	$0,8(%rcx)
60	fstpt	(%rcx)
61	ret
62
632:	fyl2xp1
64	movq	%rcx,%rax
65	movq	$0,8(%rcx)
66	fstpt	(%rcx)
67	ret
68
693:	jp	4b		// in case x is �Inf
70	fstp	%st(1)
71	fstp	%st(1)
72	movq	%rcx,%rax
73	movq	$0,8(%rcx)
74	fstpt	(%rcx)
75	ret
76#else
77	fldln2
78	fldt	4(%esp)
79	fxam
80	fnstsw
81	fld	%st
82	sahf
83	jc	3f		// in case x is NaN or �Inf
844:
85	fabs
86	fldt	limit
87	fcompp
88	fnstsw
89	sahf
90	jnc	2f
91	faddl	one
92	fyl2x
93	ret
94
952:	fyl2xp1
96	ret
97
983:	jp	4b		// in case x is �Inf
99	fstp	%st(1)
100	fstp	%st(1)
101	ret
102#endif
103