glenn@extro.ucc.su.OZ.AU (Glenn Geers) (12/08/90)
Submitted-by: glenn@trantor Archive-name: libfpu/part04 #!/bin/sh # This is part 04 of libfpu # ============= pow.s ============== if test -f 'pow.s' -a X"$1" != X"-c"; then echo 'x - skipping pow.s (File already exists)' else echo 'x - extracting pow.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'pow.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** This file started life as a C implemenation of pow, it then evolved ** into an embeded asm version (with some C) and finally, all assembler. ** It's actually hacked assembler produced by gcc. ** ** Copyright 1990 G. Geers ** */ X .text .LC0: X .ascii "pow: DOMAIN error\12\0" X .align 4 .LC1: X .double 0d0.00000000000000000000e+00 X .align 4 .LC2: X .double 0d1.00000000000000000000e+00 X .align 4 .globl pow pow: X pushl %ebp X movl %esp,%ebp X subl $28,%esp X pushl %edi X pushl %esi X pushl %ebx X movl 16(%ebp),%esi X movl 20(%ebp),%edi X movl $0,-4(%ebp) X movl $1,%ebx X fldl 8(%ebp) X ftst X fstp %st(0) X fnstsw %ax X sahf X jae .L2 X movl %ebx,-4(%ebp) X pushl %edi X pushl %esi /**/ X fldl 16(%ebp) X X fstcw -8(%ebp) X fstcw -12(%ebp) X orw $0x0400, -12(%ebp) X fldcw -12(%ebp) X X frndint X fldcw -8(%ebp) /**/ X fstpl -16(%ebp) X pushl %edi X pushl %esi X fldl (%esp) X addl $8,%esp X fsubl -16(%ebp) X fstpl -16(%ebp) X addl $8,%esp X fldl -16(%ebp) X ftst X fstp %st(0) X fnstsw %ax X sahf X je .L3 X movl $33,errno X pushl $.LC0 X pushl $_iob+32 X call fprintf X fldl .LC1 X jmp .L1 X .align 4 .L3: X pushl %edi X pushl %esi /**/ X fldl 16(%ebp) X fistpl -8(%ebp) X movl -8(%ebp),%eax /**/ X testl %eax,%eax X jge .L5 X incl %eax .L5: X andl $-2,%eax X movl -8(%ebp),%ecx X subl %eax,%ecx X movl %ecx,%eax X testl %eax,%eax X je .L2 X xorl %ebx,%ebx .L2: X fldl 8(%ebp) X ftst X fstp %st(0) X fnstsw %ax X sahf X jne .L6 X pushl %edi X pushl %esi X fldl (%esp) X addl $8,%esp X ftst X fstp %st(0) X fnstsw %ax X sahf X je .L6 X fldl .LC1 X jmp .L1 X .align 4 .L6: X pushl %edi X pushl %esi X fldl (%esp) X addl $8,%esp X ftst X fstp %st(0) X fnstsw %ax X sahf X jne .L8 X fldl .LC2 X jmp .L1 X .align 4 .L8: /APP X fldl 16(%ebp) X fldl 8(%ebp) /NO_APP X cmpl $0,-4(%ebp) X je .L10 /APP X fchs /NO_APP .L10: /APP X fyl2x X fstl %st(1) X frndint X fstl %st(2) X fsubrp X f2xm1 X fld1 X faddp X fscale /NO_APP X testl %ebx,%ebx X jne .L1 /APP X fchs /NO_APP .L1: X leal -28(%ebp),%esp X popl %ebx X popl %esi X popl %edi X leave X ret SHAR_EOF chmod 0644 pow.s || echo 'restore of pow.s failed' Wc_c="`wc -c < 'pow.s'`" test 2128 -eq "$Wc_c" || echo 'pow.s: original size 2128, current size' "$Wc_c" fi # ============= rint.s ============== if test -f 'rint.s' -a X"$1" != X"-c"; then echo 'x - skipping rint.s (File already exists)' else echo 'x - extracting rint.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'rint.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl rint rint: X pushl %ebp X movl %esp,%ebp X X fldl 8(%ebp) X frndint X X leave X ret SHAR_EOF chmod 0644 rint.s || echo 'restore of rint.s failed' Wc_c="`wc -c < 'rint.s'`" test 326 -eq "$Wc_c" || echo 'rint.s: original size 326, current size' "$Wc_c" fi # ============= scalb.s ============== if test -f 'scalb.s' -a X"$1" != X"-c"; then echo 'x - skipping scalb.s (File already exists)' else echo 'x - extracting scalb.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'scalb.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl scalb scalb: X pushl %ebp X movl %esp,%ebp X X fildl 16(%ebp) X fldl 8(%ebp) X fscale X X leave X ret SHAR_EOF chmod 0644 scalb.s || echo 'restore of scalb.s failed' Wc_c="`wc -c < 'scalb.s'`" test 343 -eq "$Wc_c" || echo 'scalb.s: original size 343, current size' "$Wc_c" fi # ============= setcont.s ============== if test -f 'setcont.s' -a X"$1" != X"-c"; then echo 'x - skipping setcont.s (File already exists)' else echo 'x - extracting setcont.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'setcont.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl setcont X setcont: X pushl %ebp X movl %esp, %ebp X subl $4, %esp X X fnstcw -8(%ebp) X movw -8(%ebp), %ax X fldcw 8(%ebp) X X leave X ret SHAR_EOF chmod 0644 setcont.s || echo 'restore of setcont.s failed' Wc_c="`wc -c < 'setcont.s'`" test 377 -eq "$Wc_c" || echo 'setcont.s: original size 377, current size' "$Wc_c" fi # ============= setinternal.s ============== if test -f 'setinternal.s' -a X"$1" != X"-c"; then echo 'x - skipping setinternal.s (File already exists)' else echo 'x - extracting setinternal.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'setinternal.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl setinternal X setinternal: X pushl %ebp X movl %esp, %ebp X subl $4, %esp X X fnstcw -8(%ebp) X movw -8(%ebp), %ax X orw $0x007e, -8(%ebp) /* All exceptions except IOP masked */ X fldcw -8(%ebp) X X leave X ret SHAR_EOF chmod 0644 setinternal.s || echo 'restore of setinternal.s failed' Wc_c="`wc -c < 'setinternal.s'`" test 449 -eq "$Wc_c" || echo 'setinternal.s: original size 449, current size' "$Wc_c" fi # ============= sin.s ============== if test -f 'sin.s' -a X"$1" != X"-c"; then echo 'x - skipping sin.s (File already exists)' else echo 'x - extracting sin.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sin.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl sin sin: X pushl %ebp X movl %esp,%ebp X X fldl 8(%ebp) X fsin X X leave X ret SHAR_EOF chmod 0644 sin.s || echo 'restore of sin.s failed' Wc_c="`wc -c < 'sin.s'`" test 320 -eq "$Wc_c" || echo 'sin.s: original size 320, current size' "$Wc_c" fi # ============= sinh.s ============== if test -f 'sinh.s' -a X"$1" != X"-c"; then echo 'x - skipping sinh.s (File already exists)' else echo 'x - extracting sinh.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sinh.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 .LC2: X .double 0.500 X X .align 4 X .globl sinh sinh: X pushl %ebp X movl %esp,%ebp X X fldl 8(%ebp) X fldl2e X fmulp X fstl %st(1) X frndint X fstl %st(2) X fsubrp X f2xm1 X fld1 X faddp X fscale X fst %st(1) X X fld1 X fdivp X fsubrp X X fldl .LC2 X fmulp X X leave X ret SHAR_EOF chmod 0644 sinh.s || echo 'restore of sinh.s failed' Wc_c="`wc -c < 'sinh.s'`" test 487 -eq "$Wc_c" || echo 'sinh.s: original size 487, current size' "$Wc_c" fi # ============= sqrt.s ============== if test -f 'sqrt.s' -a X"$1" != X"-c"; then echo 'x - skipping sqrt.s (File already exists)' else echo 'x - extracting sqrt.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sqrt.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** ** sqrt in the prevailing precision */ X X .align 4 X .globl sqrt sqrt: X pushl %ebp X movl %esp,%ebp X X fldl 8(%ebp) X fsqrt X X leave X ret SHAR_EOF chmod 0644 sqrt.s || echo 'restore of sqrt.s failed' Wc_c="`wc -c < 'sqrt.s'`" test 359 -eq "$Wc_c" || echo 'sqrt.s: original size 359, current size' "$Wc_c" fi # ============= sqrtp.s ============== if test -f 'sqrtp.s' -a X"$1" != X"-c"; then echo 'x - skipping sqrtp.s (File already exists)' else echo 'x - extracting sqrtp.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sqrtp.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** ** sqrt in 64 bit precision always */ X X .align 4 X .globl sqrtp sqrtp: X pushl %ebp X movl %esp,%ebp X subl $8, %esp X X fnstcw -12(%ebp) /* store current control word */ X fnstcw -16(%ebp) /* store again */ X andw $0xf2ff, -12(%ebp) /* enable 64 bit precision */ X fldcw -12(%ebp) X X fldl 8(%ebp) X fsqrt X X fldcw -16(%ebp) /* restore original control word */ X X leave X ret SHAR_EOF chmod 0644 sqrtp.s || echo 'restore of sqrtp.s failed' Wc_c="`wc -c < 'sqrtp.s'`" test 605 -eq "$Wc_c" || echo 'sqrtp.s: original size 605, current size' "$Wc_c" fi # ============= tan.s ============== if test -f 'tan.s' -a X"$1" != X"-c"; then echo 'x - skipping tan.s (File already exists)' else echo 'x - extracting tan.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'tan.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl tan tan: X pushl %ebp X movl %esp,%ebp X X fldl 8(%ebp) X fptan X fstp %st(0) X X leave X ret SHAR_EOF chmod 0644 tan.s || echo 'restore of tan.s failed' Wc_c="`wc -c < 'tan.s'`" test 334 -eq "$Wc_c" || echo 'tan.s: original size 334, current size' "$Wc_c" fi # ============= tanh.s ============== if test -f 'tanh.s' -a X"$1" != X"-c"; then echo 'x - skipping tanh.s (File already exists)' else echo 'x - extracting tanh.s (Text)' sed 's/^X//' << 'SHAR_EOF' > 'tanh.s' && /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license with my modification ** as noted in the README file that accompanied this file. ** ** Copyright 1990 G. Geers ** */ X X .align 4 X .globl tanh tanh: X pushl %ebp X movl %esp,%ebp X subl $8, %esp X X fldl 8(%ebp) X fldl2e X fmulp X fstl %st(1) X frndint X fstl %st(2) X fsubrp X f2xm1 X fld1 X faddp X fscale X fstl %st(1) X fstl -16(%ebp) X X fld1 X fdivp X X fsubr X faddl -16(%ebp) X fdivrp X X leave X ret SHAR_EOF chmod 0644 tanh.s || echo 'restore of tanh.s failed' Wc_c="`wc -c < 'tanh.s'`" test 493 -eq "$Wc_c" || echo 'tanh.s: original size 493, current size' "$Wc_c" fi exit 0 -- Glenn Geers | "So when it's over, we're back to people. Department of Theoretical Physics | Just to prove that human touch can have The University of Sydney | no equal." Sydney NSW 2006 Australia | - Basia Trzetrzelewska, 'Prime Time TV'