this repo has no description
at fixPythonPipStalling 64 lines 1.7 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 12ENTRY(acosl) 13 SUBP $LOCAL_STACK_SIZE, STACKP 14 movl $0x00800000, (STACKP) // 0x1.0p-126f 15 fldt FIRST_ARG_OFFSET(STACKP) // {x} 16 fabs // {|x| } 17 18 //clip tiny values to 2**-126 to prevent underflow 19 flds (STACKP) // {2**-126, |x| } 20 fucomi %st(1), %st(0) // 21 fcmovb %st(1), %st(0) // { 2**-126 or |x|, |x| } 22 fstp %st(1) // { 2**-126 or |x| } 23 24 //handle overflow / NaN input 25 fld1 // {1, 2**-126 or |x| } 26 fucomi %st(1), %st(0) 27 jb acosl_nan 28 29 fstp %st(1) // { 1 } 30 fldt FIRST_ARG_OFFSET(STACKP) // { x, 1 } 31 je acosl_one 32 33 // asin(x) = atan( x / sqrt( 1 - x*x ) ) 34 fld %st(0) // { x, x, 1 } 35 fsubr %st(2), %st(0) // { 1-x, x, 1 } 36 fsqrt // { sqrt( 1 - x ), x, 1 } 37 fxch %st(2) // { 1, x, sqrt( 1 - x ) } 38 faddp // { 1 + x, sqrt( 1 - x ) } 39 fsqrt // { sqrt(1 + x), sqrt( 1 - x ) } 40 fpatan // { result / 2 } 41 fadd %st(0), %st(0) // { result } 42 ADDP $LOCAL_STACK_SIZE, STACKP 43 ret 44 45acosl_one: // { x, 1 } 46 fucomip %st(1), %st(0) // { 1 } 47 fldpi // { pi, 1 } 48 fld %st(1) // { 1, pi, 1 } 49 fsubr %st(0), %st(2) // { 1, pi, 0 } 50 fcmove %st(2), %st(0) // { pi or 0, 0 } 51 fadd %st(1), %st(0) // { pi+1, pi, 0 } //set inexact 52 fstp %st(0) 53 fcmove %st(1), %st(0) // { pi or 0, 0 } 54 fstp %st(1) // { pi or 0 } 55 ADDP $LOCAL_STACK_SIZE, STACKP 56 ret 57 58acosl_nan: //{ 1, |x| } 59 fstp %st(0) //{ |x| } 60 fchs //{-|x| } 61 fsqrt //{nan} set invalid flag 62 ADDP $LOCAL_STACK_SIZE, STACKP 63 ret 64