xref: /minix3/lib/libm/arch/i387/e_acos.S (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
12fe8fb19SBen Gras/*
22fe8fb19SBen Gras * Written by J.T. Conklin <jtc@NetBSD.org>.
32fe8fb19SBen Gras * Public domain.
42fe8fb19SBen Gras */
52fe8fb19SBen Gras
62fe8fb19SBen Gras#include <machine/asm.h>
72fe8fb19SBen Gras
82fe8fb19SBen Gras#include "abi.h"
92fe8fb19SBen Gras
10*0a6a1f1dSLionel SambucRCSID("$NetBSD: e_acos.S,v 1.9 2014/03/03 08:00:50 dsl Exp $")
112fe8fb19SBen Gras
122fe8fb19SBen Gras/* acos = atan (sqrt(1 - x^2) / x) */
132fe8fb19SBen GrasENTRY(__ieee754_acos)
142fe8fb19SBen Gras	XMM_ONE_ARG_DOUBLE_PROLOGUE
152fe8fb19SBen Gras	fldl	ARG_DOUBLE_ONE		/* x */
162fe8fb19SBen Gras	fld	%st(0)
172fe8fb19SBen Gras	fmul	%st(0)			/* x^2 */
182fe8fb19SBen Gras	fld1
192fe8fb19SBen Gras	fsubp				/* 1 - x^2 */
202fe8fb19SBen Gras	fsqrt				/* sqrt (1 - x^2) */
21*0a6a1f1dSLionel Sambuc	fabs				/* Change -0.0 to +0.0 */
222fe8fb19SBen Gras	fxch	%st(1)
232fe8fb19SBen Gras	fpatan
242fe8fb19SBen Gras	XMM_DOUBLE_EPILOGUE
252fe8fb19SBen Gras	ret
26