~ubuntu-branches/ubuntu/wily/musl/wily

« back to all changes in this revision

Viewing changes to src/math/x32/exp2l.s

  • Committer: Package Import Robot
  • Author(s): Kevin Bortis
  • Date: 2014-03-22 09:39:56 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140322093956-1oc4xt9b2n3domo7
Tags: 1.0.0-1
* Import upstream version 1.0.0
* Provide musl-ldd (Closes: #732169)
* Arch independent ld-musl-config (Closes: #739205)

Show diffs side-by-side

added added

removed removed

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