Import OpenBSD's libm (trunk, 4 July 2015) to a new vendor branch
[dragonfly.git] / contrib / openbsd_libm / arch / amd64 / e_asin.S
1 /*      $OpenBSD: e_asin.S,v 1.3 2008/09/07 20:36:08 martynas Exp $ */
2 /*
3  * Written by J.T. Conklin <jtc@NetBSD.org>.
4  * Public domain.
5  */
6
7 #include <machine/asm.h>
8
9 #include "abi.h"
10
11 /* asin = atan (x / sqrt(1 - x^2)) */
12 ENTRY(asin)
13         XMM_ONE_ARG_DOUBLE_PROLOGUE
14         fldl    ARG_DOUBLE_ONE          /* x */
15         fld     %st(0)
16         fmul    %st(0)                  /* x^2 */
17         fld1
18         fsubp                           /* 1 - x^2 */
19         fsqrt                           /* sqrt (1 - x^2) */
20         fpatan
21         XMM_DOUBLE_EPILOGUE
22         ret