⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idigitdiv.s

📁 Arithmetic for integers of almost unlimited size for C and C++. Developed and copyrighted by Ra
💻 S
字号:
; Thomas Pfahler, Nov 21 1997; DigitType  DigitDiv (quot, h,   l,   d  );                      $26,  $25, $24, $23;      DigitType *quot, h, l, d;;{;      /*  Suppose:    d>0 and h<d  */;      *quot=QUOT;;      return REM;;      /*  where QUOT, REM are defined by:;          h*2^BitsPerDigit + l == d*QUOT + REM, 2^BitsPerDigit > REM >= 0  */;}; IMPORTANT NOTE:; ---------------; This file is based on the file; 	mpn/hppa/hppa1_1/udiv_qrnnd.s  from GNU MP version 2.0.2; and has been modified by Thomas Pfahler on Nov 21 1997.;;; Modifications:;; - function name is now DigitDiv instead of __udiv_qrnnd; - function now returns the remainder instead fo the quotient; - similarly, the input register r26 is now supposed to contain a pointer;   to the quotient instead of a pointer to the remainder; - some comments were added; ----------------------------------------------------------------------; original comment block [START]; ----------------------------------------------------------------------; HP-PA  __udiv_qrnnd division support, used from longlong.h.; This version runs fast on PA 7000 and later.; Copyright (C) 1993, 1994 Free Software Foundation, Inc.; This file is part of the GNU MP Library.; The GNU MP Library is free software; you can redistribute it and/or modify; it under the terms of the GNU Library General Public License as published by; the Free Software Foundation; either version 2 of the License, or (at your; option) any later version.; The GNU MP Library is distributed in the hope that it will be useful, but; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public; License for more details.; You should have received a copy of the GNU Library General Public License; along with the GNU MP Library; see the file COPYING.LIB.  If not, write to; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,; MA 02111-1307, USA.; ----------------------------------------------------------------------; original comment block [END]; ----------------------------------------------------------------------; INPUT PARAMETERS; quot_ptr	gr26; n1		gr25; n0		gr24; d		gr23	.codeL$0000	.word		0x43f00000	.word		0x0	.export		DigitDivDigitDiv	.proc	.callinfo	frame=64,no_calls	.entry	ldo		64(%r30),%r30		; inc. stack pointer	stws		%r25,-16(0,%r30)	; n_hi	stws		%r24,-12(0,%r30)	; n_lo	ldil		L'L$0000,%r19		;	ldo		R'L$0000(%r19),%r19	; %r19 <- 0x43f00000	fldds		-16(0,%r30),%fr5	; load n (dbl word!) into %fr5	stws		%r23,-12(0,%r30)	; store d	comib,<=	0,%r25,L$1		; branch to L$1 if n_hi <= 0	fcnvxf,dbl,dbl	%fr5,%fr5		; %fr5: 64bit->dbl	fldds		0(0,%r19),%fr4		; %fr4 <- %r19	fadd,dbl	%fr4,%fr5,%fr5		; %fr5 += %fr4L$1	fcpy,sgl	%fr0,%fr6L		; save status register in %fr6L	fldws		-12(0,%r30),%fr6R	; load n_lo into %fr6R	fcnvxf,dbl,dbl	%fr6,%fr4		; %fr4 <- %fr6 (64bit->dbl)	fdiv,dbl	%fr5,%fr4,%fr5		; %fr5 = %fr5/ %fr4	fcnvfx,dbl,dbl	%fr5,%fr4		; %fr4 <- %fr5 (dbl->64bit)	fstws		%fr4R,-16(%r30)		; 	xmpyu		%fr4R,%fr6R,%fr6	; %fr6 <- %fr4R * %fr6R (fixed)	ldws		-16(%r30),%r22		; %r22 = q	fstds		%fr6,-16(0,%r30)	; 	ldws		-12(0,%r30),%r21	; 	ldws		-16(0,%r30),%r20	; 	sub		%r24,%r21,%r28		; 	subb		%r25,%r20,%r19		; %r19 = n - q*d	comib,=		0,%r19,L$2		; if < 0, add d	ldo		-64(%r30),%r30		; re-set stack pointer	add		%r28,%r23,%r28		; 	ldo		-1(%r22),%r22		; q -= 1L$2	bv		0(%r2)			; 	stws		%r22,0(0,%r26)		; store %r22 to quot_ptr	.exit	.procend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -