Annotation of 43BSD/usr.lib/libm/VAX/tan.s, revision 1.1

1.1     ! root        1: # 
        !             2: # Copyright (c) 1985 Regents of the University of California.
        !             3: # 
        !             4: # Use and reproduction of this software are granted  in  accordance  with
        !             5: # the terms and conditions specified in  the  Berkeley  Software  License
        !             6: # Agreement (in particular, this entails acknowledgement of the programs'
        !             7: # source, and inclusion of this notice) with the additional understanding
        !             8: # that  all  recipients  should regard themselves as participants  in  an
        !             9: # ongoing  research  project and hence should  feel  obligated  to report
        !            10: # their  experiences (good or bad) with these elementary function  codes,
        !            11: # using "sendbug 4bsd-bugs@BERKELEY", to the authors.
        !            12: #
        !            13: 
        !            14: # @(#)tan.s    1.1 (Berkeley) 8/21/85
        !            15: 
        !            16: #  This is the implementation of Peter Tang's double precision  
        !            17: #  tangent for the VAX using Bob Corbett's argument reduction.
        !            18: #  
        !            19: #  Notes:
        !            20: #       under 1,024,000 random arguments testing on [0,2*pi] 
        !            21: #       tan() observed maximum error = 2.15 ulps
        !            22: #
        !            23: # double tan(arg)
        !            24: # double arg;
        !            25: # method: true range reduction to [-pi/4,pi/4], P. Tang  &  B. Corbett
        !            26: # S. McDonald, April 4,  1985
        !            27: #
        !            28:        .globl  _tan
        !            29:        .text
        !            30:        .align  1
        !            31: 
        !            32: _tan:  .word   0xffc           # save r2-r11
        !            33:        movq    4(ap),r0
        !            34:        bicw3   $0x807f,r0,r2
        !            35:        beql    1f              # if x is zero or reserved operand then return x
        !            36: #
        !            37: # Save the PSL's IV & FU bits on the stack.
        !            38: #
        !            39:        movpsl  r2
        !            40:        bicw3   $0xff9f,r2,-(sp)
        !            41: #
        !            42: #  Clear the IV & FU bits.
        !            43: #
        !            44:        bicpsw  $0x0060
        !            45:        jsb     libm$argred
        !            46: #
        !            47: #  At this point,
        !            48: #         r0  contains the quadrant number, 0, 1, 2, or 3;
        !            49: #      r2/r1  contains the reduced argument as a D-format number;
        !            50: #         r3  contains a F-format extension to the reduced argument;
        !            51: #
        !            52: #  Save  r3/r0  so that we can call cosine after calling sine.
        !            53: #
        !            54:        movq    r2,-(sp)
        !            55:        movq    r0,-(sp)
        !            56: #
        !            57: #  Call sine.  r4 = 0  implies sine.
        !            58: #
        !            59:        movl    $0,r4
        !            60:        jsb     libm$sincos
        !            61: #
        !            62: #  Save  sin(x)  in  r11/r10 .
        !            63: #
        !            64:        movd    r0,r10
        !            65: #
        !            66: #  Call cosine.  r4 = 1  implies cosine.
        !            67: #
        !            68:        movq    (sp)+,r0
        !            69:        movq    (sp)+,r2
        !            70:        movl    $1,r4
        !            71:        jsb     libm$sincos
        !            72:        divd3   r0,r10,r0
        !            73:        bispsw  (sp)+
        !            74: 1:     ret

unix.superglobalmegacorp.com

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