Annotation of Net2/arch/tahoe/math/klogf.s, revision 1.1.1.1

1.1       root        1: /*-
                      2:  * Copyright (c) 1985 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This code is derived from software contributed to Berkeley by
                      6:  * Computer Consoles Inc.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by the University of
                     19:  *     California, Berkeley and its contributors.
                     20:  * 4. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  *
                     36:  *     @(#)Klogf.s     7.1 (Berkeley) 12/6/90
                     37:  */
                     38: 
                     39: #include "../tahoe/SYS.h"
                     40: 
                     41:        .text
                     42: ENTRY(Klogf, R5|R4|R3|R2)
                     43:        subl3   $88,fp,sp
                     44:        clrl    8(fp)
                     45:        tstl    4(fp)
                     46:        jgtr    L53
                     47:        movl    small+4,r1
                     48:        movl    small,r0
                     49:        ret
                     50: L53:   pushl   20(fp)                  # hfs
                     51:        subl3   $88,fp,-(sp)            # &exp
                     52:        pushl   8(fp)                   # arg
                     53:        pushl   4(fp)
                     54:        callf   $20,_Kfrexpf
                     55:        ldd     r0
                     56:                                        # movl  r1,-56(fp)
                     57:        std     -60(fp)                 # movl  r0,-60(fp)
                     58:        jbr     L55
                     59: L2000001:
                     60:        pushl   20(fp)                  # hfs
                     61:        ldd     two                     # 2.0
                     62:        pushd
                     63:        ldd     -60(fp)                 # x
                     64:        pushd   
                     65:        callf   $24,_Kmuld
                     66:        ldd     r0
                     67:        std     -60(fp)
                     68:        subl2   $1,-88(fp)
                     69: L55:   cmpd2   -60(fp),half
                     70:        jlss    L2000001
                     71:        cmpd2   -60(fp),_sqrto2
                     72:        jgeq    L59
                     73:        pushl   20(fp)                  # hfs
                     74:        ldd     -60(fp)                 # x
                     75:        pushd
                     76:        ldd     two                     # 2.0
                     77:        pushd
                     78:        callf   $24,_Kmuld
                     79:        ldd     r0
                     80:        std     -60(fp)
                     81:        subl2   $1,-88(fp)
                     82: L59:   pushl   20(fp)                  # hfs
                     83:        ldd     one                     # 1.0
                     84:        pushd
                     85:        ldd     -60(fp)                 # x
                     86:        pushd
                     87:        callf   $24,_Ksubd      
                     88:        ldd     r0
                     89:        std     r2
                     90:        pushl   20(fp)                  # hfs
                     91:        ldd     one                     # 1.0
                     92:        pushd
                     93:        ldd     -60(fp)                 # x
                     94:        pushd
                     95:        callf   $24,_Kaddd
                     96:        ldd     r0
                     97:        std     r4
                     98:        pushl   20(fp)                  # hfs
                     99:        ldd     r4                      # temp result of x-1
                    100:        pushd
                    101:        ldd     r2                      # temp result of x+1
                    102:        pushd
                    103:        callf   $24,_Kdivd
                    104:        ldd     r0
                    105:        std     -68(fp)                 # z
                    106:        pushl   20(fp)                  # hfs
                    107:        pushd                           # z
                    108:        pushd                           # z
                    109:        callf   $24,_Kmuld
                    110:        ldd     r0
                    111:        std     -76(fp)                 # zsq
                    112:        pushl   20(fp)                  # hfs
                    113:        ldd     -76(fp)                 # zsq
                    114:        pushd
                    115:        ldd     _p1                     # p1
                    116:        pushd
                    117:        callf   $24,_Kmuld
                    118:        ldd     r0
                    119:        std     r2
                    120:        pushl   20(fp)                  # hfs
                    121:        ldd     _p0                     # p0
                    122:        pushd
                    123:        ldd     r2
                    124:        pushd
                    125:        callf   $24,_Kaddd
                    126:        ldd     r0
                    127:        std     -84(fp)                 # temp
                    128:        pushl   20(fp)                  # hfs
                    129:        ldd     -76(fp)                 # zsq
                    130:        pushd
                    131:        ldd     _q1
                    132:        pushd
                    133:        callf   $24,_Kmuld
                    134:        ldd     r0
                    135:        std     r2
                    136:        pushl   20(fp)                  # hfs
                    137:        ldd     _q0                     # q0
                    138:        pushd
                    139:        ldd     r2
                    140:        pushd
                    141:        callf   $24,_Kaddd
                    142:        ldd     r0
                    143:        std     r2                      # temp result of (q1*zsq+q0)
                    144:        pushl   20(fp)                  # hfs
                    145:        ldd     r2
                    146:        pushd
                    147:        ldd     -84(fp)                 # temp
                    148:        pushd
                    149:        callf   $24,_Kdivd
                    150:        ldd     r0
                    151:        std     -84(fp)                 # put in temp
                    152:        pushl   20(fp)                  # hfs
                    153:        ldd     -68(fp)                 # z
                    154:        pushd
                    155:        ldd     -84(fp)
                    156:        pushd
                    157:        callf   $24,_Kmuld
                    158:        ldd     r0
                    159:        std     r2
                    160:        pushl   20(fp)                  #hfs
                    161:        pushl   $0                      # 0 pad
                    162:        pushl   -88(fp)                 # exp
                    163:        pushl   $0                      # dummy
                    164:        pushl   $0                      # dummy
                    165:        callf   $24,_Kcvtld
                    166:        pushl   20(fp)                  # hfs
                    167:        ldd     _log2                   # log2
                    168:        pushd
                    169:        pushl   r1                      # exp converted
                    170:        pushl   r0                      
                    171:        callf   $24,_Kmuld
                    172:        ldd     r0
                    173:        std     r4
                    174:        pushl   20(fp)                  # hfs
                    175:        ldd     r2                      # result of temp*z
                    176:        pushd
                    177:        ldd     r4
                    178:        pushd
                    179:        callf   $24,_Kaddd
                    180:        ldd     r0
                    181:        cvdf
                    182:        stf     r0
                    183:        clrl    r1
                    184:        ret
                    185: 
                    186:        .data
                    187:        .align  2
                    188: _log2: .long   0x40317217, 0xf7d1cf7a # .double 0.69314718055994531
                    189: _ln10: .long   0x41135d8d, 0xddaaa8ac # .double 2.3025850929940457
                    190: _sqrto2:.long  0x403504f3, 0x33f9de65 # .double 0.70710678118654753
                    191: _p0:   .long   0xc154114d, 0xeb0ba468 # .double -3.31355617479
                    192: _p1:   .long   0x40654226, 0x56bd0c4c # .double 0.89554061525
                    193: _q0:   .long   0xc0d4114c, 0xfdc7df02 # .double -1.65677797691
                    194: _q1:   .long   0x40800000, 0x00000000 # .double 1
                    195: small: .long   0xfffffffe, 0xfffffffe # .double -1.7014117331926443e+38
                    196: half:  .long   0x40000000, 0x00000000 # .double 0.5
                    197: two:   .long   0x41000000, 0x00000000 # .double 2
                    198: one:   .long   0x40800000, 0x00000000 # .double 1

unix.superglobalmegacorp.com

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