1*f504f610SAugustin Cavalier.global expm1l 2*f504f610SAugustin Cavalier.type expm1l,@function 3*f504f610SAugustin Cavalierexpm1l: 4*f504f610SAugustin Cavalier fldt 8(%rsp) 5*f504f610SAugustin Cavalier fldl2e 6*f504f610SAugustin Cavalier fmulp 7*f504f610SAugustin Cavalier movl $0xc2820000,-4(%rsp) 8*f504f610SAugustin Cavalier flds -4(%rsp) 9*f504f610SAugustin Cavalier fucomip %st(1),%st 10*f504f610SAugustin Cavalier fld1 11*f504f610SAugustin Cavalier jb 1f 12*f504f610SAugustin Cavalier # x*log2e <= -65, return -1 without underflow 13*f504f610SAugustin Cavalier fstp %st(1) 14*f504f610SAugustin Cavalier fchs 15*f504f610SAugustin Cavalier ret 16*f504f610SAugustin Cavalier1: fld %st(1) 17*f504f610SAugustin Cavalier fabs 18*f504f610SAugustin Cavalier fucomip %st(1),%st 19*f504f610SAugustin Cavalier fstp %st(0) 20*f504f610SAugustin Cavalier ja 1f 21*f504f610SAugustin Cavalier f2xm1 22*f504f610SAugustin Cavalier ret 23*f504f610SAugustin Cavalier1: push %rax 24*f504f610SAugustin Cavalier call 1f 25*f504f610SAugustin Cavalier pop %rax 26*f504f610SAugustin Cavalier fld1 27*f504f610SAugustin Cavalier fsubrp 28*f504f610SAugustin Cavalier ret 29*f504f610SAugustin Cavalier 30*f504f610SAugustin Cavalier.global exp2l 31*f504f610SAugustin Cavalier.type exp2l,@function 32*f504f610SAugustin Cavalierexp2l: 33*f504f610SAugustin Cavalier fldt 8(%rsp) 34*f504f610SAugustin Cavalier1: fld %st(0) 35*f504f610SAugustin Cavalier sub $16,%rsp 36*f504f610SAugustin Cavalier fstpt (%rsp) 37*f504f610SAugustin Cavalier mov 8(%rsp),%ax 38*f504f610SAugustin Cavalier and $0x7fff,%ax 39*f504f610SAugustin Cavalier cmp $0x3fff+13,%ax 40*f504f610SAugustin Cavalier jb 4f # |x| < 8192 41*f504f610SAugustin Cavalier cmp $0x3fff+15,%ax 42*f504f610SAugustin Cavalier jae 3f # |x| >= 32768 43*f504f610SAugustin Cavalier fsts (%rsp) 44*f504f610SAugustin Cavalier cmpl $0xc67ff800,(%rsp) 45*f504f610SAugustin Cavalier jb 2f # x > -16382 46*f504f610SAugustin Cavalier movl $0x5f000000,(%rsp) 47*f504f610SAugustin Cavalier flds (%rsp) # 0x1p63 48*f504f610SAugustin Cavalier fld %st(1) 49*f504f610SAugustin Cavalier fsub %st(1) 50*f504f610SAugustin Cavalier faddp 51*f504f610SAugustin Cavalier fucomip %st(1),%st 52*f504f610SAugustin Cavalier je 2f # x - 0x1p63 + 0x1p63 == x 53*f504f610SAugustin Cavalier movl $1,(%rsp) 54*f504f610SAugustin Cavalier flds (%rsp) # 0x1p-149 55*f504f610SAugustin Cavalier fdiv %st(1) 56*f504f610SAugustin Cavalier fstps (%rsp) # raise underflow 57*f504f610SAugustin Cavalier2: fld1 58*f504f610SAugustin Cavalier fld %st(1) 59*f504f610SAugustin Cavalier frndint 60*f504f610SAugustin Cavalier fxch %st(2) 61*f504f610SAugustin Cavalier fsub %st(2) # st(0)=x-rint(x), st(1)=1, st(2)=rint(x) 62*f504f610SAugustin Cavalier f2xm1 63*f504f610SAugustin Cavalier faddp # 2^(x-rint(x)) 64*f504f610SAugustin Cavalier1: fscale 65*f504f610SAugustin Cavalier fstp %st(1) 66*f504f610SAugustin Cavalier add $16,%rsp 67*f504f610SAugustin Cavalier ret 68*f504f610SAugustin Cavalier3: xor %eax,%eax 69*f504f610SAugustin Cavalier4: cmp $0x3fff-64,%ax 70*f504f610SAugustin Cavalier fld1 71*f504f610SAugustin Cavalier jb 1b # |x| < 0x1p-64 72*f504f610SAugustin Cavalier fstpt (%rsp) 73*f504f610SAugustin Cavalier fistl 8(%rsp) 74*f504f610SAugustin Cavalier fildl 8(%rsp) 75*f504f610SAugustin Cavalier fsubrp %st(1) 76*f504f610SAugustin Cavalier addl $0x3fff,8(%rsp) 77*f504f610SAugustin Cavalier f2xm1 78*f504f610SAugustin Cavalier fld1 79*f504f610SAugustin Cavalier faddp # 2^(x-rint(x)) 80*f504f610SAugustin Cavalier fldt (%rsp) # 2^rint(x) 81*f504f610SAugustin Cavalier fmulp 82*f504f610SAugustin Cavalier add $16,%rsp 83*f504f610SAugustin Cavalier ret 84