Annotation of 43BSDTahoe/sys/tahoemath/Ksqrtf.s, revision 1.1.1.1

1.1       root        1: /*     Ksqrtf.s        1.3     86/01/05        */
                      2: 
                      3: #include "../tahoe/SYS.h"
                      4: 
                      5:        .text
                      6: ENTRY(Ksqrtf, 0)
                      7:        subl3   $76,fp,sp
                      8:        tstl    4(fp)                   # if (arg <= 0.) {
                      9:        jgtr    L18
                     10:        jgeq    L19                     # if (arg < 0.)
                     11: L19:   clrl    r1
                     12:        clrl    r0
                     13:        ret                             # return(0.);}
                     14: L18:   
                     15:        pushl   20(fp)                  # hfs
                     16:        subl3   $72,fp,-(sp)
                     17:        pushl   8(fp)
                     18:        pushl   4(fp)
                     19:        callf   $20,_Kfrexpf
                     20:        clrl    -60+4(fp)
                     21:        movl    r0,-60(fp)              # x = frexp(arg,&exp);
                     22:        jbr     L20
                     23: L2000001:
                     24:        pushl   20(fp)                  # hfs
                     25:        ldd     two
                     26:        pushd
                     27:        ldd     -60(fp)
                     28:        pushd
                     29:        callf   $24,_Kmuld              # x * 2
                     30:        ldd     r0
                     31:        std     -60(fp)                 # x *= 2;
                     32:        decl    -72(fp)                 # exp--;}
                     33: L20:   cmpd2   -60(fp),half            # while(x < 0.5){
                     34:        jlss    L2000001
                     35:        bitl    $1,-72(fp)              # if(exp & 1) {
                     36:        jeql    L24
                     37:        pushl   20(fp)                  # hfs
                     38:        ldd     two
                     39:        pushd
                     40:        ldd     -60(fp)
                     41:        pushd
                     42:        callf   $24,_Kmuld              # x * 2
                     43:        ldd     r0
                     44:        std     -60(fp)                 # x *= 2;
                     45:        decl    -72(fp)                 # exp--;}
                     46: L24:   pushl   20(fp)                  # hfs
                     47:        ldd     -60(fp)
                     48:        pushd
                     49:        ldd     one
                     50:        pushd
                     51:        callf   $24,_Kaddd              # (1.0+x)
                     52:        pushl   20(fp)                  # hfs
                     53:        ldd     r0
                     54:        pushd
                     55:        ldd     half
                     56:        pushd
                     57:        callf   $24,_Kmuld
                     58:        ldd     r0
                     59:        std     -68(fp)                  # temp=0.5*(1.0+x);
                     60:        jbr     L28
                     61: L2000003:
                     62:        pushl   20(fp)                  # hfs
                     63:        ldd     big
                     64:        pushd
                     65:        ldd     -68(fp)
                     66:        pushd
                     67:        callf   $24,_Kmuld              # temp*(1L<<30)
                     68:        ldd     r0
                     69:        std     -68(fp)                 # temp *=(1L<<30);
                     70:        subl2   $60,-72(fp)             # exp -= 60;}
                     71: L28:   cmpl    -72(fp),$60             # while(exp > 60){
                     72:        jleq    L31
                     73:        jbr     L2000003
                     74: L2000005:
                     75:        pushl   20(fp)                  # hfs
                     76:        ldd     big
                     77:        pushd
                     78:        ldd     -68(fp)
                     79:        pushd
                     80:        callf   $24,_Kdivd
                     81:        ldd     r0
                     82:        std     -68(fp)                 # temp /= (1L<<30);
                     83:        addl2   $60,-72(fp)             # exp +=60;}
                     84: L31:   cmpl    -72(fp),$-60            # while(exp < -60) {
                     85:        jlss    L2000005
                     86:        tstl    -72(fp)                 # if(exp >=0)
                     87:        jlss    L34
                     88:        divl3   $2,-72(fp),r0
                     89:        shll    r0,$1,r0
                     90:        pushl   20(fp)                  # hfs
                     91:        pushl   $0
                     92:        pushl   r0
                     93:        pushl   $0
                     94:        pushl   $0
                     95:        callf   $24,_Kcvtld
                     96:        pushl   20(fp)                  # hfs
                     97:        ldd     r0
                     98:        pushd
                     99:        ldd     -68(fp)
                    100:        pushd
                    101:        callf   $24,_Kmuld              # temp * (1L <<(exp/2))
                    102:        jbr     L2000006                # temp *= 1L << (exp/2));
                    103: L34:   mnegl   -72(fp),r0              # -exp
                    104:        divl2   $2,r0                   # -exp/2
                    105:        shll    r0,$1,r0
                    106:        pushl   20(fp)                  # hfs
                    107:        pushl   $0
                    108:        pushl   r0
                    109:        pushl   $0
                    110:        pushl   $0
                    111:        callf   $24,_Kcvtld
                    112:        pushl   20(fp)                  # hfs
                    113:        ldd     r0
                    114:        pushd
                    115:        ldd     -68(fp)
                    116:        pushd
                    117:        callf   $24,_Kdivd              # temp / (1L <<(-exp/2))
                    118: L2000006:
                    119:        ldd     r0
                    120:        std     -68(fp)                 # temp (*/)= 1L << (exp/2));
                    121:        clrl    -76(fp)
                    122: L2000008:
                    123:        pushl   20(fp)                  # hfs
                    124:        ldd     -68(fp)
                    125:        pushd
                    126:        ldd     4(fp)
                    127:        pushd
                    128:        callf   $24,_Kdivd
                    129:        pushl   20(fp)                  # hfs
                    130:        ldd     r0
                    131:        pushd
                    132:        ldd     -68(fp)
                    133:        pushd
                    134:        callf   $24,_Kaddd
                    135:        pushl   20(fp)                  # hfs
                    136:        ldd     r0      
                    137:        pushd
                    138:        ldd     half
                    139:        pushd
                    140:        callf   $24,_Kmuld
                    141:        ldd     r0
                    142:        std     -68(fp)                 # temp=0.5*(temp+arg/temp);
                    143:        aobleq  $3,-76(fp),L2000008
                    144:        ldd     -68(fp)
                    145:        cvdf
                    146:        stf     r0
                    147:        ret
                    148: 
                    149:        .data
                    150:        .align  2
                    151: half:  .long   0x40000000, 0x00000000 # .double .5
                    152: two:   .long   0x41000000, 0x00000000 # .double 2
                    153: one:   .long   0x40800000, 0x00000000 # .double 1
                    154: big:   .long   0x4F800000, 0x00000000 # .double (1<<30)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.