this repo has no description
at fixPythonPipStalling 49 lines 1.2 kB view raw
1/* 2 * Written by Ian Ollmann 3 * 4 * Copyright 2005, Apple Computer Inc. All Rights Reserved. 5 */ 6 7#include <machine/asm.h> 8 9#define LOCAL_STACK_SIZE 4 10#include "abi.h" 11 12 13// atan (x / sqrt(1 - x**2)) 14 15ENTRY(asinl) 16 SUBP $4, STACKP 17 movl $0x00800000, (STACKP) // 0x1.0p-126f 18 fldt FIRST_ARG_OFFSET(STACKP) // {x} 19 fld %st(0) // { x, x } 20 fabs // {|x|, x } 21 22 //clip tiny values to 2**-126 to prevent underflow 23 flds (STACKP) // {2**-126, |x|, x } 24 fucomi %st(1), %st(0) // 25 fcmovb %st(1), %st(0) // { 2**-126 or |x|, |x|, x } 26 fstp %st(1) // { 2**-126 or |x|, x } 27 28 //handle overflow / NaN input 29 fld1 // {1, 2**-126 or |x|, x } 30 fucomi %st(1), %st(0) 31 jb asinl_nan 32 33 // asin(x) = atan( x / sqrt( 1 - x*x ) ) 34 fld %st(1) // { |x|, 1, |x|, x } 35 fmulp %st(0), %st(2) // { 1, x*x, x } 36 fsubp // { 1 - x*x, x } 37 fsqrt // { (1-x*x)**0.5, x } 38 fpatan // { result } 39 ADDP $LOCAL_STACK_SIZE, STACKP 40 ret 41 42asinl_nan: //{ 1, |x|, x } 43 fstp %st(0) //{ |x|, x } 44 fchs //{-|x|, x } 45 fsqrt //{nan, x} set invalid flag 46 fstp %st(1) //{ nan } 47 ADDP $LOCAL_STACK_SIZE, STACKP 48 ret 49