add directory gnu
This commit is contained in:
47
gnu/glibc/glibc-1.03/math/bsd/vax/__infnan.s
Normal file
47
gnu/glibc/glibc-1.03/math/bsd/vax/__infnan.s
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 1985 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted provided
|
||||
* that: (1) source distributions retain this entire copyright notice and
|
||||
* comment, and (2) distributions including binaries display the following
|
||||
* acknowledgement: ``This product includes software developed by the
|
||||
* University of California, Berkeley and its contributors'' in the
|
||||
* documentation or other materials provided with the distribution and in
|
||||
* all advertising materials mentioning features or use of this software.
|
||||
* Neither the name of the University nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)infnan.s 5.5 (Berkeley) 10/9/90
|
||||
*/
|
||||
.data
|
||||
.align 2
|
||||
_sccsid:
|
||||
.asciz "@(#)infnan.s 1.1 (Berkeley) 8/21/85; 5.5 (ucb.elefunt) 10/9/90"
|
||||
|
||||
/*
|
||||
* infnan(arg) int arg;
|
||||
* where arg := EDOM if result is NaN
|
||||
* := ERANGE if result is +INF
|
||||
* := -ERANGE if result is -INF
|
||||
*
|
||||
* The Reserved Operand Fault is generated inside of this routine.
|
||||
*/
|
||||
.globl _infnan
|
||||
.set EDOM,33
|
||||
.set ERANGE,34
|
||||
.text
|
||||
.align 1
|
||||
___infnan:
|
||||
.word 0x0
|
||||
cmpl 4(ap),$ERANGE
|
||||
bneq 1f
|
||||
movl $ERANGE,_errno
|
||||
brb 2f
|
||||
1: movl $EDOM,_errno
|
||||
2: emodd $0,$0,$0x8000,r0,r0 # generates the reserved operand fault
|
||||
ret
|
||||
205
gnu/glibc/glibc-1.03/math/bsd/vax/atan2.s
Normal file
205
gnu/glibc/glibc-1.03/math/bsd/vax/atan2.s
Normal file
@@ -0,0 +1,205 @@
|
||||
# Copyright (c) 1985 Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted provided
|
||||
# that: (1) source distributions retain this entire copyright notice and
|
||||
# comment, and (2) distributions including binaries display the following
|
||||
# acknowledgement: ``This product includes software developed by the
|
||||
# University of California, Berkeley and its contributors'' in the
|
||||
# documentation or other materials provided with the distribution and in
|
||||
# all advertising materials mentioning features or use of this software.
|
||||
# Neither the name of the University nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# @(#)atan2.s 5.4 (Berkeley) 10/9/90
|
||||
#
|
||||
.data
|
||||
.align 2
|
||||
_sccsid:
|
||||
.asciz "@(#)atan2.s 1.2 (Berkeley) 8/21/85; 5.4 (ucb.elefunt) 10/9/90"
|
||||
|
||||
# ATAN2(Y,X)
|
||||
# RETURN ARG (X+iY)
|
||||
# VAX D FORMAT (56 BITS PRECISION)
|
||||
# CODED IN VAX ASSEMBLY LANGUAGE BY K.C. NG, 4/16/85;
|
||||
#
|
||||
#
|
||||
# Method :
|
||||
# 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
|
||||
# 2. Reduce x to positive by (if x and y are unexceptional):
|
||||
# ARG (x+iy) = arctan(y/x) ... if x > 0,
|
||||
# ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
|
||||
# 3. According to the integer k=4t+0.25 truncated , t=y/x, the argument
|
||||
# is further reduced to one of the following intervals and the
|
||||
# arctangent of y/x is evaluated by the corresponding formula:
|
||||
#
|
||||
# [0,7/16] atan(y/x) = t - t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)
|
||||
# [7/16,11/16] atan(y/x) = atan(1/2) + atan( (y-x/2)/(x+y/2) )
|
||||
# [11/16.19/16] atan(y/x) = atan( 1 ) + atan( (y-x)/(x+y) )
|
||||
# [19/16,39/16] atan(y/x) = atan(3/2) + atan( (y-1.5x)/(x+1.5y) )
|
||||
# [39/16,INF] atan(y/x) = atan(INF) + atan( -x/y )
|
||||
#
|
||||
# Special cases:
|
||||
# Notations: atan2(y,x) == ARG (x+iy) == ARG(x,y).
|
||||
#
|
||||
# ARG( NAN , (anything) ) is NaN;
|
||||
# ARG( (anything), NaN ) is NaN;
|
||||
# ARG(+(anything but NaN), +-0) is +-0 ;
|
||||
# ARG(-(anything but NaN), +-0) is +-PI ;
|
||||
# ARG( 0, +-(anything but 0 and NaN) ) is +-PI/2;
|
||||
# ARG( +INF,+-(anything but INF and NaN) ) is +-0 ;
|
||||
# ARG( -INF,+-(anything but INF and NaN) ) is +-PI;
|
||||
# ARG( +INF,+-INF ) is +-PI/4 ;
|
||||
# ARG( -INF,+-INF ) is +-3PI/4;
|
||||
# ARG( (anything but,0,NaN, and INF),+-INF ) is +-PI/2;
|
||||
#
|
||||
# Accuracy:
|
||||
# atan2(y,x) returns the exact ARG(x+iy) nearly rounded.
|
||||
#
|
||||
.text
|
||||
.align 1
|
||||
.globl _atan2
|
||||
_atan2 :
|
||||
.word 0x0ff4
|
||||
movq 4(ap),r2 # r2 = y
|
||||
movq 12(ap),r4 # r4 = x
|
||||
bicw3 $0x7f,r2,r0
|
||||
bicw3 $0x7f,r4,r1
|
||||
cmpw r0,$0x8000 # y is the reserved operand
|
||||
jeql resop
|
||||
cmpw r1,$0x8000 # x is the reserved operand
|
||||
jeql resop
|
||||
subl2 $8,sp
|
||||
bicw3 $0x7fff,r2,-4(fp) # copy y sign bit to -4(fp)
|
||||
bicw3 $0x7fff,r4,-8(fp) # copy x sign bit to -8(fp)
|
||||
cmpd r4,$0x4080 # x = 1.0 ?
|
||||
bneq xnot1
|
||||
movq r2,r0
|
||||
bicw2 $0x8000,r0 # t = |y|
|
||||
movq r0,r2 # y = |y|
|
||||
brb begin
|
||||
xnot1:
|
||||
bicw3 $0x807f,r2,r11 # yexp
|
||||
jeql yeq0 # if y=0 goto yeq0
|
||||
bicw3 $0x807f,r4,r10 # xexp
|
||||
jeql pio2 # if x=0 goto pio2
|
||||
subw2 r10,r11 # k = yexp - xexp
|
||||
cmpw r11,$0x2000 # k >= 64 (exp) ?
|
||||
jgeq pio2 # atan2 = +-pi/2
|
||||
divd3 r4,r2,r0 # t = y/x never overflow
|
||||
bicw2 $0x8000,r0 # t > 0
|
||||
bicw2 $0xff80,r2 # clear the exponent of y
|
||||
bicw2 $0xff80,r4 # clear the exponent of x
|
||||
bisw2 $0x4080,r2 # normalize y to [1,2)
|
||||
bisw2 $0x4080,r4 # normalize x to [1,2)
|
||||
subw2 r11,r4 # scale x so that yexp-xexp=k
|
||||
begin:
|
||||
cmpw r0,$0x411c # t : 39/16
|
||||
jgeq L50
|
||||
addl3 $0x180,r0,r10 # 8*t
|
||||
cvtrfl r10,r10 # [8*t] rounded to int
|
||||
ashl $-1,r10,r10 # [8*t]/2
|
||||
casel r10,$0,$4
|
||||
L1:
|
||||
.word L20-L1
|
||||
.word L20-L1
|
||||
.word L30-L1
|
||||
.word L40-L1
|
||||
.word L40-L1
|
||||
L10:
|
||||
movq $0xb4d9940f985e407b,r6 # Hi=.98279372324732906796d0
|
||||
movq $0x21b1879a3bc2a2fc,r8 # Lo=-.17092002525602665777d-17
|
||||
subd3 r4,r2,r0 # y-x
|
||||
addw2 $0x80,r0 # 2(y-x)
|
||||
subd2 r4,r0 # 2(y-x)-x
|
||||
addw2 $0x80,r4 # 2x
|
||||
movq r2,r10
|
||||
addw2 $0x80,r10 # 2y
|
||||
addd2 r10,r2 # 3y
|
||||
addd2 r4,r2 # 3y+2x
|
||||
divd2 r2,r0 # (2y-3x)/(2x+3y)
|
||||
brw L60
|
||||
L20:
|
||||
cmpw r0,$0x3280 # t : 2**(-28)
|
||||
jlss L80
|
||||
clrq r6 # Hi=r6=0, Lo=r8=0
|
||||
clrq r8
|
||||
brw L60
|
||||
L30:
|
||||
movq $0xda7b2b0d63383fed,r6 # Hi=.46364760900080611433d0
|
||||
movq $0xf0ea17b2bf912295,r8 # Lo=.10147340032515978826d-17
|
||||
movq r2,r0
|
||||
addw2 $0x80,r0 # 2y
|
||||
subd2 r4,r0 # 2y-x
|
||||
addw2 $0x80,r4 # 2x
|
||||
addd2 r2,r4 # 2x+y
|
||||
divd2 r4,r0 # (2y-x)/(2x+y)
|
||||
brb L60
|
||||
L50:
|
||||
movq $0x68c2a2210fda40c9,r6 # Hi=1.5707963267948966135d1
|
||||
movq $0x06e0145c26332326,r8 # Lo=.22517417741562176079d-17
|
||||
cmpw r0,$0x5100 # y : 2**57
|
||||
bgeq L90
|
||||
divd3 r2,r4,r0
|
||||
bisw2 $0x8000,r0 # -x/y
|
||||
brb L60
|
||||
L40:
|
||||
movq $0x68c2a2210fda4049,r6 # Hi=.78539816339744830676d0
|
||||
movq $0x06e0145c263322a6,r8 # Lo=.11258708870781088040d-17
|
||||
subd3 r4,r2,r0 # y-x
|
||||
addd2 r4,r2 # y+x
|
||||
divd2 r2,r0 # (y-x)/(y+x)
|
||||
L60:
|
||||
movq r0,r10
|
||||
muld2 r0,r0
|
||||
polyd r0,$12,ptable
|
||||
muld2 r10,r0
|
||||
subd2 r0,r8
|
||||
addd3 r8,r10,r0
|
||||
addd2 r6,r0
|
||||
L80:
|
||||
movw -8(fp),r2
|
||||
bneq pim
|
||||
bisw2 -4(fp),r0 # return sign(y)*r0
|
||||
ret
|
||||
L90: # x >= 2**25
|
||||
movq r6,r0
|
||||
brb L80
|
||||
pim:
|
||||
subd3 r0,$0x68c2a2210fda4149,r0 # pi-t
|
||||
bisw2 -4(fp),r0
|
||||
ret
|
||||
yeq0:
|
||||
movw -8(fp),r2
|
||||
beql zero # if sign(x)=1 return pi
|
||||
movq $0x68c2a2210fda4149,r0 # pi=3.1415926535897932270d1
|
||||
ret
|
||||
zero:
|
||||
clrq r0 # return 0
|
||||
ret
|
||||
pio2:
|
||||
movq $0x68c2a2210fda40c9,r0 # pi/2=1.5707963267948966135d1
|
||||
bisw2 -4(fp),r0 # return sign(y)*pi/2
|
||||
ret
|
||||
resop:
|
||||
movq $0x8000,r0 # propagate the reserved operand
|
||||
ret
|
||||
.align 2
|
||||
ptable:
|
||||
.quad 0xb50f5ce96e7abd60
|
||||
.quad 0x51e44a42c1073e02
|
||||
.quad 0x3487e3289643be35
|
||||
.quad 0xdb62066dffba3e54
|
||||
.quad 0xcf8e2d5199abbe70
|
||||
.quad 0x26f39cb884883e88
|
||||
.quad 0x135117d18998be9d
|
||||
.quad 0x602ce9742e883eba
|
||||
.quad 0xa35ad0be8e38bee3
|
||||
.quad 0xffac922249243f12
|
||||
.quad 0x7f14ccccccccbf4c
|
||||
.quad 0xaa8faaaaaaaa3faa
|
||||
.quad 0x0000000000000000
|
||||
119
gnu/glibc/glibc-1.03/math/bsd/vax/cabs.s
Normal file
119
gnu/glibc/glibc-1.03/math/bsd/vax/cabs.s
Normal file
@@ -0,0 +1,119 @@
|
||||
# Copyright (c) 1985 Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted provided
|
||||
# that: (1) source distributions retain this entire copyright notice and
|
||||
# comment, and (2) distributions including binaries display the following
|
||||
# acknowledgement: ``This product includes software developed by the
|
||||
# University of California, Berkeley and its contributors'' in the
|
||||
# documentation or other materials provided with the distribution and in
|
||||
# all advertising materials mentioning features or use of this software.
|
||||
# Neither the name of the University nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# @(#)cabs.s 5.4 (Berkeley) 10/9/90
|
||||
#
|
||||
.data
|
||||
.align 2
|
||||
_sccsid:
|
||||
.asciz "@(#)cabs.s 1.2 (Berkeley) 8/21/85; 5.4 (ucb.elefunt) 10/9/90"
|
||||
|
||||
# double precision complex absolute value
|
||||
# CABS by W. Kahan, 9/7/80.
|
||||
# Revised for reserved operands by E. LeBlanc, 8/18/82
|
||||
# argument for complex absolute value by reference, *4(ap)
|
||||
# argument for cabs and hypot (C fcns) by value, 4(ap)
|
||||
# output is in r0:r1 (error less than 0.86 ulps)
|
||||
|
||||
.text
|
||||
.align 1
|
||||
.globl _cabs
|
||||
.globl _hypot
|
||||
.globl _z_abs
|
||||
.globl libm$cdabs_r6
|
||||
.globl libm$dsqrt_r5
|
||||
|
||||
# entry for c functions cabs and hypot
|
||||
_cabs:
|
||||
_hypot:
|
||||
.word 0x807c # save r2-r6, enable floating overflow
|
||||
movq 4(ap),r0 # r0:1 = x
|
||||
movq 12(ap),r2 # r2:3 = y
|
||||
jmp cabs2
|
||||
# entry for Fortran use, call by: d = abs(z)
|
||||
_z_abs:
|
||||
.word 0x807c # save r2-r6, enable floating overflow
|
||||
movl 4(ap),r2 # indirect addressing is necessary here
|
||||
movq (r2)+,r0 # r0:1 = x
|
||||
movq (r2),r2 # r2:3 = y
|
||||
|
||||
cabs2:
|
||||
bicw3 $0x7f,r0,r4 # r4 has signed biased exp of x
|
||||
cmpw $0x8000,r4
|
||||
jeql return # x is a reserved operand, so return it
|
||||
bicw3 $0x7f,r2,r5 # r5 has signed biased exp of y
|
||||
cmpw $0x8000,r5
|
||||
jneq cont # y isn't a reserved operand
|
||||
movq r2,r0 # return y if it's reserved
|
||||
ret
|
||||
|
||||
cont:
|
||||
bsbb regs_set # r0:1 = dsqrt(x^2+y^2)/2^r6
|
||||
addw2 r6,r0 # unscaled cdabs in r0:1
|
||||
jvc return # unless it overflows
|
||||
subw2 $0x80,r0 # halve r0 to get meaningful overflow
|
||||
addd2 r0,r0 # overflow; r0 is half of true abs value
|
||||
return:
|
||||
ret
|
||||
|
||||
libm$cdabs_r6: # ENTRY POINT for cdsqrt
|
||||
# calculates a scaled (factor in r6)
|
||||
# complex absolute value
|
||||
|
||||
movq (r4)+,r0 # r0:r1 = x via indirect addressing
|
||||
movq (r4),r2 # r2:r3 = y via indirect addressing
|
||||
|
||||
bicw3 $0x7f,r0,r5 # r5 has signed biased exp of x
|
||||
cmpw $0x8000,r5
|
||||
jeql cdreserved # x is a reserved operand
|
||||
bicw3 $0x7f,r2,r5 # r5 has signed biased exp of y
|
||||
cmpw $0x8000,r5
|
||||
jneq regs_set # y isn't a reserved operand either?
|
||||
|
||||
cdreserved:
|
||||
movl *4(ap),r4 # r4 -> (u,v), if x or y is reserved
|
||||
movq r0,(r4)+ # copy u and v as is and return
|
||||
movq r2,(r4) # (again addressing is indirect)
|
||||
ret
|
||||
|
||||
regs_set:
|
||||
bicw2 $0x8000,r0 # r0:r1 = dabs(x)
|
||||
bicw2 $0x8000,r2 # r2:r3 = dabs(y)
|
||||
cmpw r0,r2
|
||||
jgeq ordered
|
||||
movq r0,r4
|
||||
movq r2,r0
|
||||
movq r4,r2 # force y's exp <= x's exp
|
||||
ordered:
|
||||
bicw3 $0x7f,r0,r6 # r6 = exponent(x) + bias(129)
|
||||
jeql retsb # if x = y = 0 then cdabs(x,y) = 0
|
||||
subw2 $0x4780,r6 # r6 = exponent(x) - 14
|
||||
subw2 r6,r0 # 2^14 <= scaled x < 2^15
|
||||
bitw $0xff80,r2
|
||||
jeql retsb # if y = 0 return dabs(x)
|
||||
subw2 r6,r2
|
||||
cmpw $0x3780,r2 # if scaled y < 2^-18
|
||||
jgtr retsb # return dabs(x)
|
||||
emodd r0,$0,r0,r4,r0 # r4 + r0:1 = scaled x^2
|
||||
emodd r2,$0,r2,r5,r2 # r5 + r2:3 = scaled y^2
|
||||
addd2 r2,r0
|
||||
addl2 r5,r4
|
||||
cvtld r4,r2
|
||||
addd2 r2,r0 # r0:1 = scaled x^2 + y^2
|
||||
jmp libm$dsqrt_r5 # r0:1 = dsqrt(x^2+y^2)/2^r6
|
||||
retsb:
|
||||
rsb # error < 0.86 ulp
|
||||
86
gnu/glibc/glibc-1.03/math/bsd/vax/cbrt.s
Normal file
86
gnu/glibc/glibc-1.03/math/bsd/vax/cbrt.s
Normal file
@@ -0,0 +1,86 @@
|
||||
# Copyright (c) 1985 Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted provided
|
||||
# that: (1) source distributions retain this entire copyright notice and
|
||||
# comment, and (2) distributions including binaries display the following
|
||||
# acknowledgement: ``This product includes software developed by the
|
||||
# University of California, Berkeley and its contributors'' in the
|
||||
# documentation or other materials provided with the distribution and in
|
||||
# all advertising materials mentioning features or use of this software.
|
||||
# Neither the name of the University nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# @(#)cbrt.s 5.4 (Berkeley) 10/9/90
|
||||
#
|
||||
.data
|
||||
.align 2
|
||||
_sccsid:
|
||||
.asciz "@(#)cbrt.s 1.1 (Berkeley) 5/23/85; 5.4 (ucb.elefunt) 10/9/90"
|
||||
|
||||
# double cbrt(double arg)
|
||||
# W. Kahan, 10/13/80. revised 1/13/84 for keeping sign symmetry
|
||||
# error check by E LeBlanc, 8/18/82
|
||||
# Revised and tested by K.C. Ng, 5/2/85
|
||||
# Max error less than 0.667 ulps (unit in the last places)
|
||||
.globl _cbrt
|
||||
.globl _d_cbrt
|
||||
.globl _dcbrt_
|
||||
.text
|
||||
.align 1
|
||||
|
||||
_cbrt:
|
||||
_d_cbrt:
|
||||
.word 0x00fc # save r2 to r7
|
||||
movq 4(ap),r0 # r0 = argument x
|
||||
jmp dcbrt2
|
||||
_dcbrt_:
|
||||
.word 0x00fc # save r2 to r7
|
||||
movq *4(ap),r0 # r0 = argument x
|
||||
|
||||
dcbrt2: bicw3 $0x807f,r0,r2 # biased exponent of x
|
||||
jeql return # dcbrt(0)=0 dcbrt(res)=res. operand
|
||||
bicw3 $0x7fff,r0,ap # ap has sign(x)
|
||||
xorw2 ap,r0 # r0 is abs(x)
|
||||
movl r0,r2 # r2 has abs(x)
|
||||
rotl $16,r2,r2 # r2 = |x| with bits unscrambled
|
||||
divl2 $3,r2 # rough dcbrt with bias/3
|
||||
addl2 B,r2 # restore bias, diminish fraction
|
||||
rotl $16,r2,r2 # r2=|q|=|dcbrt| to 5 bits
|
||||
mulf3 r2,r2,r3 # r3 =qq
|
||||
divf2 r0,r3 # r3 = qq/x
|
||||
mulf2 r2,r3
|
||||
addf2 C,r3 # r3 = s = C + qqq/x
|
||||
divf3 r3,D,r4 # r4 = D/s
|
||||
addf2 E,r4
|
||||
addf2 r4,r3 # r3 = s + E + D/s
|
||||
divf3 r3,F,r3 # r3 = F / (s + E + D/s)
|
||||
addf2 G,r3 # r3 = G + F / (s + E + D/s)
|
||||
mulf2 r3,r2 # r2 = qr3 = new q to 23 bits
|
||||
clrl r3 # r2:r3 = q as double float
|
||||
muld3 r2,r2,r4 # r4:r5 = qq exactly
|
||||
divd2 r4,r0 # r0:r1 = x/(q*q) rounded
|
||||
subd3 r2,r0,r6 # r6:r7 = x/(q*q) - q exactly
|
||||
movq r2,r4 # r4:r5 = q
|
||||
addw2 $0x80,r4 # r4:r5 = 2 * q
|
||||
addd2 r0,r4 # r4:r5 = 2*q + x/(q*q)
|
||||
divd2 r4,r6 # r6:r7 = (x/(q*q)-q)/(2*q+x/(q*q))
|
||||
muld2 r2,r6 # r6:r7 = q*(x/(q*q)-q)/(2*q+x/(q*q))
|
||||
addd3 r6,r2,r0 # r0:r1 = q + r6:r7
|
||||
bisw2 ap,r0 # restore the sign bit
|
||||
return:
|
||||
ret # error less than 0.667 ulps
|
||||
|
||||
.data
|
||||
.align 2
|
||||
B : .long 721142941 # (86-0.03306235651)*(2^23)
|
||||
C : .float 0f0.5428571429 # 19/35
|
||||
D : .float 0f-0.7053061224 # -864/1225
|
||||
E : .float 0f1.414285714 # 99/70
|
||||
F : .float 0f1.607142857 # 45/28
|
||||
G : .float 0f0.3571428571 # 5/14
|
||||
|
||||
110
gnu/glibc/glibc-1.03/math/bsd/vax/sqrt.s
Normal file
110
gnu/glibc/glibc-1.03/math/bsd/vax/sqrt.s
Normal file
@@ -0,0 +1,110 @@
|
||||
# Copyright (c) 1985 Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted provided
|
||||
# that: (1) source distributions retain this entire copyright notice and
|
||||
# comment, and (2) distributions including binaries display the following
|
||||
# acknowledgement: ``This product includes software developed by the
|
||||
# University of California, Berkeley and its contributors'' in the
|
||||
# documentation or other materials provided with the distribution and in
|
||||
# all advertising materials mentioning features or use of this software.
|
||||
# Neither the name of the University nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
LAR PURPOSE.
|
||||
#
|
||||
# @(#)sqrt.s 5.4 (Berkeley) 10/9/90
|
||||
#
|
||||
.data
|
||||
.align 2
|
||||
_sccsid:
|
||||
.asciz "@(#)sqrt.s 1.1 (Berkeley) 8/21/85; 5.4 (ucb.elefunt) 10/9/90"
|
||||
|
||||
/*
|
||||
* double sqrt(arg) revised August 15,1982
|
||||
* double arg;
|
||||
* if(arg<0.0) { _errno = EDOM; return(<a reserved operand>); }
|
||||
* if arg is a reserved operand it is returned as it is
|
||||
* W. Kahan's magic square root
|
||||
* coded by Heidi Stettner and revised by Emile LeBlanc 8/18/82
|
||||
*
|
||||
* entry points:_d_sqrt address of double arg is on the stack
|
||||
* _sqrt double arg is on the stack
|
||||
*/
|
||||
.text
|
||||
.align 1
|
||||
.globl _sqrt
|
||||
.globl _d_sqrt
|
||||
.globl libm$dsqrt_r5
|
||||
.set EDOM,33
|
||||
|
||||
_d_sqrt:
|
||||
.word 0x003c # save r5,r4,r3,r2
|
||||
movq *4(ap),r0
|
||||
jmp dsqrt2
|
||||
_sqrt:
|
||||
.word 0x003c # save r5,r4,r3,r2
|
||||
movq 4(ap),r0
|
||||
dsqrt2: bicw3 $0x807f,r0,r2 # check exponent of input
|
||||
jeql noexp # biased exponent is zero -> 0.0 or reserved
|
||||
bsbb libm$dsqrt_r5
|
||||
noexp: ret
|
||||
|
||||
/* **************************** internal procedure */
|
||||
|
||||
libm$dsqrt_r5: # ENTRY POINT FOR cdabs and cdsqrt
|
||||
# returns double square root scaled by
|
||||
# 2^r6
|
||||
|
||||
movd r0,r4
|
||||
jleq nonpos # argument is not positive
|
||||
movzwl r4,r2
|
||||
ashl $-1,r2,r0
|
||||
addw2 $0x203c,r0 # r0 has magic initial approximation
|
||||
/*
|
||||
* Do two steps of Heron's rule
|
||||
* ((arg/guess) + guess) / 2 = better guess
|
||||
*/
|
||||
divf3 r0,r4,r2
|
||||
addf2 r2,r0
|
||||
subw2 $0x80,r0 # divide by two
|
||||
|
||||
divf3 r0,r4,r2
|
||||
addf2 r2,r0
|
||||
subw2 $0x80,r0 # divide by two
|
||||
|
||||
/* Scale argument and approximation to prevent over/underflow */
|
||||
|
||||
bicw3 $0x807f,r4,r1
|
||||
subw2 $0x4080,r1 # r1 contains scaling factor
|
||||
subw2 r1,r4
|
||||
movl r0,r2
|
||||
subw2 r1,r2
|
||||
|
||||
/* Cubic step
|
||||
*
|
||||
* b = a + 2*a*(n-a*a)/(n+3*a*a) where b is better approximation,
|
||||
* a is approximation, and n is the original argument.
|
||||
* (let s be scale factor in the following comments)
|
||||
*/
|
||||
clrl r1
|
||||
clrl r3
|
||||
muld2 r0,r2 # r2:r3 = a*a/s
|
||||
subd2 r2,r4 # r4:r5 = n/s - a*a/s
|
||||
addw2 $0x100,r2 # r2:r3 = 4*a*a/s
|
||||
addd2 r4,r2 # r2:r3 = n/s + 3*a*a/s
|
||||
muld2 r0,r4 # r4:r5 = a*n/s - a*a*a/s
|
||||
divd2 r2,r4 # r4:r5 = a*(n-a*a)/(n+3*a*a)
|
||||
addw2 $0x80,r4 # r4:r5 = 2*a*(n-a*a)/(n+3*a*a)
|
||||
addd2 r4,r0 # r0:r1 = a + 2*a*(n-a*a)/(n+3*a*a)
|
||||
rsb # DONE!
|
||||
nonpos:
|
||||
jneq negarg
|
||||
ret # argument and root are zero
|
||||
negarg:
|
||||
pushl $EDOM
|
||||
calls $1,_infnan # generate the reserved op fault
|
||||
ret
|
||||
84
gnu/glibc/glibc-1.03/math/bsd/vax/tan.s
Normal file
84
gnu/glibc/glibc-1.03/math/bsd/vax/tan.s
Normal file
@@ -0,0 +1,84 @@
|
||||
# Copyright (c) 1985 Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted provided
|
||||
# that: (1) source distributions retain this entire copyright notice and
|
||||
# comment, and (2) distributions including binaries display the following
|
||||
# acknowledgement: ``This product includes software developed by the
|
||||
# University of California, Berkeley and its contributors'' in the
|
||||
# documentation or other materials provided with the distribution and in
|
||||
# all advertising materials mentioning features or use of this software.
|
||||
# Neither the name of the University nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
LAR PURPOSE.
|
||||
#
|
||||
# @(#)tan.s 5.4 (Berkeley) 10/9/90
|
||||
#
|
||||
.data
|
||||
.align 2
|
||||
_sccsid:
|
||||
.asciz "@(#)tan.s 1.1 (Berkeley) 8/21/85; 5.4 (ucb.elefunt) 10/9/90"
|
||||
|
||||
# This is the implementation of Peter Tang's double precision
|
||||
# tangent for the VAX using Bob Corbett's argument reduction.
|
||||
#
|
||||
# Notes:
|
||||
# under 1,024,000 random arguments testing on [0,2*pi]
|
||||
# tan() observed maximum error = 2.15 ulps
|
||||
#
|
||||
# double tan(arg)
|
||||
# double arg;
|
||||
# method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett
|
||||
# S. McDonald, April 4, 1985
|
||||
#
|
||||
.globl _tan
|
||||
.text
|
||||
.align 1
|
||||
|
||||
_tan: .word 0xffc # save r2-r11
|
||||
movq 4(ap),r0
|
||||
bicw3 $0x807f,r0,r2
|
||||
beql 1f # if x is zero or reserved operand then return x
|
||||
#
|
||||
# Save the PSL's IV & FU bits on the stack.
|
||||
#
|
||||
movpsl r2
|
||||
bicw3 $0xff9f,r2,-(sp)
|
||||
#
|
||||
# Clear the IV & FU bits.
|
||||
#
|
||||
bicpsw $0x0060
|
||||
jsb libm$argred
|
||||
#
|
||||
# At this point,
|
||||
# r0 contains the quadrant number, 0, 1, 2, or 3;
|
||||
# r2/r1 contains the reduced argument as a D-format number;
|
||||
# r3 contains a F-format extension to the reduced argument;
|
||||
#
|
||||
# Save r3/r0 so that we can call cosine after calling sine.
|
||||
#
|
||||
movq r2,-(sp)
|
||||
movq r0,-(sp)
|
||||
#
|
||||
# Call sine. r4 = 0 implies sine.
|
||||
#
|
||||
movl $0,r4
|
||||
jsb libm$sincos
|
||||
#
|
||||
# Save sin(x) in r11/r10 .
|
||||
#
|
||||
movd r0,r10
|
||||
#
|
||||
# Call cosine. r4 = 1 implies cosine.
|
||||
#
|
||||
movq (sp)+,r0
|
||||
movq (sp)+,r2
|
||||
movl $1,r4
|
||||
jsb libm$sincos
|
||||
divd3 r0,r10,r0
|
||||
bispsw (sp)+
|
||||
1: ret
|
||||
Reference in New Issue
Block a user