xref: /reactos/sdk/lib/crt/math/i386/exp_asm.s (revision 9393fc32)
1*c2c66affSColin Finck
2*c2c66affSColin Finck#include <asm.inc>
3*c2c66affSColin Finck
4*c2c66affSColin FinckPUBLIC _exp
5*c2c66affSColin Finck
6*c2c66affSColin Finck/* FUNCTIONS ***************************************************************/
7*c2c66affSColin Finck.code
8*c2c66affSColin Finck
9*c2c66affSColin Finck_exp:
10*c2c66affSColin Finck    push ebp
11*c2c66affSColin Finck    mov ebp, esp
12*c2c66affSColin Finck
13*c2c66affSColin Finck    fld qword ptr [ebp + 8]
14*c2c66affSColin Finck    fxam
15*c2c66affSColin Finck    fstsw ax
16*c2c66affSColin Finck    fwait
17*c2c66affSColin Finck    sahf
18*c2c66affSColin Finck    jnp .not_inf
19*c2c66affSColin Finck    jnc .not_inf
20*c2c66affSColin Finck    test ah, 2
21*c2c66affSColin Finck    jz .done
22*c2c66affSColin Finck    fstp st
23*c2c66affSColin Finck    fldz
24*c2c66affSColin Finck    jmp .done
25*c2c66affSColin Finck.not_inf:
26*c2c66affSColin Finck    fldl2e
27*c2c66affSColin Finck    fmul st, st(1)
28*c2c66affSColin Finck    fst st(1)
29*c2c66affSColin Finck    frndint
30*c2c66affSColin Finck    fxch st(1)
31*c2c66affSColin Finck    fsub st, st(1)
32*c2c66affSColin Finck    f2xm1
33*c2c66affSColin Finck    fld1
34*c2c66affSColin Finck    faddp st(1), st
35*c2c66affSColin Finck    fscale
36*c2c66affSColin Finck    fstp st(1)
37*c2c66affSColin Finck.done:
38*c2c66affSColin Finck    pop ebp
39*c2c66affSColin Finck    ret
40*c2c66affSColin Finck
41*c2c66affSColin FinckEND
42