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