summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/i386/ipow.S
blob: cca6a0ce1787e77591183cfabb75e93866a3607c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# This is not standard, but often you only need such this function
# which is much shorter than the generic pow() function.
#
#   double  ipow ( double mant, int expo );
#

.text
.global ipow
.type   ipow,@function

ipow:   fld1
        movl    12(%esp),%ecx
        fldl    4(%esp)
        and     %ecx,%ecx
        jns     .Lstart
        negl    %ecx
        fdivr   %st(1),%st(0)
        jmp     .Lstart

.Lnext: fmul    %st(0),%st(0)
.Lstart:shrl    %ecx
        jnc     .Lnomul
        fmul    %st(0),%st(1)
.Lnomul:jnz     .Lnext
        fcomp
        ret