about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_asin.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu/e_asin.S')
-rw-r--r--sysdeps/i386/fpu/e_asin.S34
1 files changed, 33 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/e_asin.S b/sysdeps/i386/fpu/e_asin.S
index 9a44cb62ac..ea8cb6f1b2 100644
--- a/sysdeps/i386/fpu/e_asin.S
+++ b/sysdeps/i386/fpu/e_asin.S
@@ -7,8 +7,26 @@
 
 RCSID("$NetBSD: e_asin.S,v 1.4 1995/05/08 23:45:40 jtc Exp $")
 
+	.section .rodata.cst8,"aM",@progbits,8
+
+	.p2align 3
+	.type dbl_min,@object
+dbl_min:	.byte 0, 0, 0, 0, 0, 0, 0x10, 0
+	ASM_SIZE_DIRECTIVE(dbl_min)
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+	.text
+
 /* asin = atan (x / sqrt((1-x) (1+x))) */
 ENTRY(__ieee754_asin)
+#ifdef  PIC
+	LOAD_PIC_REG (cx)
+#endif
 	fldl	4(%esp)			/* x */
 	fld	%st
 	fld1				/* 1 : x : x */
@@ -18,6 +36,20 @@ ENTRY(__ieee754_asin)
 	fmulp				/* 1 - x^2 */
 	fsqrt				/* sqrt (1 - x^2) */
 	fpatan
-	ret
+	fldl	MO(dbl_min)
+	fld	%st(1)
+	fabs
+	fucompp
+	fnstsw
+	sahf
+	jnc	1f
+	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
+	fld	%st(0)
+	fmul	%st(0)
+	fstpl	(%esp)
+	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
+1:	ret
 END (__ieee754_asin)
 strong_alias (__ieee754_asin, __asin_finite)