diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-05-07 22:19:31 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-05-07 22:19:31 +0000 |
commit | 7657493d64c6d80359ef3a35f5de5a09b490b1ea (patch) | |
tree | e59f824bdf0e43a5fdbc0821e0882cf802ee4283 /sys/arch/hppa/spmath/impys.S | |
parent | b02e4f767517ffad3d92f4cfb03fd681231fa3e4 (diff) |
bring over our mods; the cnv*c have a problem now, described in the osf version of the cnv_float.h, at the end
Diffstat (limited to 'sys/arch/hppa/spmath/impys.S')
-rw-r--r-- | sys/arch/hppa/spmath/impys.S | 124 |
1 files changed, 50 insertions, 74 deletions
diff --git a/sys/arch/hppa/spmath/impys.S b/sys/arch/hppa/spmath/impys.S index b1f1287c528..10ba5f98a1d 100644 --- a/sys/arch/hppa/spmath/impys.S +++ b/sys/arch/hppa/spmath/impys.S @@ -1,69 +1,45 @@ -/* $OpenBSD: impys.S,v 1.6 2002/01/04 08:50:30 miod Exp $ */ - -/* - * Copyright 1996 1995 by Open Software Foundation, Inc. - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies and - * that both the copyright notice and this permission notice appear in - * supporting documentation. - * - * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, - * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ +/* $OpenBSD: impys.S,v 1.7 2002/05/07 22:19:30 mickey Exp $ */ /* - * pmk1.1 - */ -/* - * (c) Copyright 1986 HEWLETT-PACKARD COMPANY - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Hewlett-Packard Company not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * Hewlett-Packard Company makes no representations about the - * suitability of this software for any purpose. - */ + (c) Copyright 1986 HEWLETT-PACKARD COMPANY + To anyone who acknowledges that this file is provided "AS IS" + without any express or implied warranty: + permission to use, copy, modify, and distribute this file + for any purpose is hereby granted without fee, provided that + the above copyright notice and this notice appears in all + copies, and that the name of Hewlett-Packard Company not be + used in advertising or publicity pertaining to distribution + of the software without specific, written prior permission. + Hewlett-Packard Company makes no representations about the + suitability of this software for any purpose. +*/ +/* @(#)impys.s: Revision: 1.11.88.1 Date: 93/12/07 15:06:28 */ #include <machine/asm.h> -/**************************************************************************** - * - * Implement an integer multiply routine for 32-bit operands and 64-bit product - * with operand values of zero (multiplicand only) and -2**31 treated specially. - * The algorithm uses the absolute value of the multiplier, four bits at a time, - * from right to left, to generate partial product. Execution speed is more - * important than program size in this implementation. - * - ***************************************************************************/ -/* - * Definitions - General registers - */ -gr0 .equ 0 /* General register zero */ -pu .equ 3 /* upper part of product */ -pl .equ 4 /* lower part of product */ -op2 .equ 4 /* multiplier */ -op1 .equ 5 /* multiplicand */ -cnt .equ 6 /* count in multiply */ -brindex .equ 7 /* index into the br. table */ -sign .equ 8 /* sign of product */ -pc .equ 9 /* carry bit of product, = 00...01 */ -pm .equ 10 /* value of -1 used in shifting */ +;**************************************************************************** +; +;Implement an integer multiply routine for 32-bit operands and 64-bit product +;with operand values of zero (multiplicand only) and -2**31 treated specially. +;The algorithm uses the absolute value of the multiplier, four bits at a time, +;from right to left, to generate partial product. Execution speed is more +;important than program size in this implementation. +; +;**************************************************************************** +; +; Definitions - General registers +; +gr0 .equ 0 ; General register zero +pu .equ 3 ; upper part of product +pl .equ 4 ; lower part of product +op2 .equ 4 ; multiplier +op1 .equ 5 ; multiplicand +cnt .equ 6 ; count in multiply +brindex .equ 7 ; index into the br. table +sign .equ 8 ; sign of product +pc .equ 9 ; carry bit of product, = 00...01 +pm .equ 10 ; value of -1 used in shifting +;***************************************************************************** .text LEAF_ENTRY(impys) @@ -88,14 +64,14 @@ mpy1 comb,< op1,gr0,mpya ; br. if multiplicand < 0 addib,= 0,op1,fini0 ; op1 = 0, product = 0 mpy2 addi 1,gr0,pc ; initialize pc to 00...01 movib,tr 8,cnt,mloop ; set count for mpy loop - extru op2,31,4,brindex ; 4 bits as index into table + extru op2,31,4,brindex ; 4 bits as index into table ; .align 8 ; b sh4c ; br. if sign overflow sh4n shd pu,pl,4,pl ; shift product right 4 bits addib,<= -1,cnt,mulend ; reduce count by 1, exit if - extru pu,27,28,pu ; <= zero + extru pu,27,28,pu ; <= zero ; mloop blr brindex,gr0 ; br. into table ; entries of 2 words @@ -118,13 +94,13 @@ mtable ; two words per entry ; ; ---- bits = 0010 ---- add op1, add op1, then shift 4 bits ; - addb,tr op1,pu,sh4n ; add 2*op1, to shift - addb,uv op1,pu,sh4c ; product right 4 bits + addb,tr op1,pu,sh4n ; add 2*op1, to shift + addb,uv op1,pu,sh4c ; product right 4 bits ; ; ---- bits = 0011 ---- add op1, add 2*op1, shift 4 bits ; - addb,tr op1,pu,sh4n-4 ; add op1 & 2*op1, shift - sh1add,nsv op1,pu,pu ; product right 4 bits + addb,tr op1,pu,sh4n-4 ; add op1 & 2*op1, shift + sh1add,nsv op1,pu,pu ; product right 4 bits ; ; ---- bits = 0100 ---- shift 2, add op1, shift 2 ; @@ -207,21 +183,21 @@ sh4c addib,> -1,cnt,mloop ; decrement count, loop if > 0 mpyb add,= op2,op2,gr0 ; if <> 0, back to main sect. b mpy1 sub 0,op2,op2 ; op2 = |multiplier| - add,>= op1,gr0,gr0 ; if op1 < 0, invert sign, + add,>= op1,gr0,gr0 ; if op1 < 0, invert sign, xor pm,sign,sign ; for correct result ; ; special case for multiplier = -2**31, op1 = signed multiplicand ; or multiplicand = -2**31, op1 = signed multiplier ; shd op1,0,1,pl ; shift op1 left 31 bits -mmax extrs op1,30,31,pu +mmax extrs op1,30,31,pu b signs ; negate product (if needed) bb,>=,n sign,0,fini ; test sign of product ; mpya add,= op1,op1,gr0 ; op1 = -2**31, special case b mpy2 sub 0,op1,op1 ; op1 = |multiplicand| - add,>= op2,gr0,gr0 ; if op2 < 0, invert sign, + add,>= op2,gr0,gr0 ; if op2 < 0, invert sign, xor pm,sign,sign ; for correct result movb,tr op2,op1,mmax ; use op2 as multiplicand shd op1,0,1,pl ; shift it left 31 bits @@ -252,8 +228,8 @@ sh1 addib,> -1,cnt,mloop ; loop if count > 0 sh2ns addib,tr 1,brindex,sh2sb+4 ; increment index extru pu,29,30,pu ; shift unsigned ; -sh2s shd pu,pl,2,pl ; shift with minus sign - shd pm,pu,2,pu ; +sh2s shd pu,pl,2,pl ; shift with minus sign + shd pm,pu,2,pu ; sub pu,op1,pu ; subtract op1 shd pu,pl,2,pl ; shift with minus sign addib,tr -1,cnt,mloop ; decrement count, loop @@ -279,7 +255,7 @@ sh2us extru pu,29,30,pu ; shift 2 unsigned addb,tr op1,pu,sh2a ; add op1 shd pu,pl,2,pl ; shift 2 bits ; -sh2c shd pu,pl,2,pl +sh2c shd pu,pl,2,pl shd pc,pu,2,pu ; shift with carry addb,tr op1,pu,sh2a ; add op1 to product shd pu,pl,2,pl ; br. to sh2 to shift pu @@ -309,6 +285,6 @@ fini stws pu,0(arg2) ; save high part of result ldws,mb -4(sp),pl ; restore registers bv 0(rp) ; return ldws,mb -4(sp),pu ; restore registers +EXIT(imyps) -EXIT(impys) .end |