.lo 3,2 .lm 0.rm 72 .fl bold.fl break.fl capitalize.fl hyphenate.fl index.xl.fl period .nhd .fgd 15 .c;^*QUADMATH\* .b 5 .c;^*^&Quadword Math Routines\&\* .b 10 .c;by .b .c;^&Rodrick A. Eldridge\& .c;^&Iowa State University\& .pg .c;^*Overview\* .b 2 This paper presents a set of routines which implement, in VAX-11 Macro, quadword math routines to add, clear, compare, divide, move, multiply, subtract and test quadword values. .b 3 .nt ^*Notice\* .b 2 In order to reassemble these routines, you must have the MLR Macro Language. The MLR Macro Language is a set of macros that implement structured programming in VAX-11 Macro. .en .pg .lt ------------------------------------------------------------------------ ADDQ add,sum ADDQ3 add1,add2,sum ------------------------------------------------------------------------ .el .b 3 The ADDQ procedure will add one quadword to another and leave the result in the second quadword. The ADDQ3 procedure will add one quadword to another and leave the result in a third quadword. .b After the addition is performed, r0 will contain one of the following values: .b .lt -1 if sum < 0 0 if sum = 0 1 if sum > 0 .el .b The ADDQ procedure is equivalent to the expression: .b .lt sum = add + sum .el .b and the ADDQ3 procedure is equivalent to the expression: .b .lt sum = add1 + add2 .el .b 2 MLR Example: .b .lt var add1: .blkq 1 add2: .blkq 1 sum: .blkq 1 external module addq external module addq3 addq q^add1,q^sum addq3 q^add1,q^add2,q^sum .el .pg .lt ------------------------------------------------------------------------ CLRQ dst ------------------------------------------------------------------------ .el .b 3 The CLRQ procedure will zero a quadword. .b After the quadword is cleared, r0 will contain one of the following value: .b .lt 0 if dst = 0 .el .b The CLRQ procedure is equivalent to the expression: .b .lt dst = 0 .el .b 2 MLR Example: .b .lt var dst: .blkq 1 external module clrq clrq q^dst .el .pg .lt ------------------------------------------------------------------------ CMPQ src,dst ------------------------------------------------------------------------ .el .b 3 The CMPQ procedure will compare a quadword with another quadword. .b After the comparision is performed, r0 will contain one of the following values: .b .lt -1 if src < dst 0 if src = dst 1 if src > dst .el .b 2 MLR Example: .b .lt var src: .blkq 1 dst: .blkq 1 external module cmpq cmpq q^src,q^dst .el .pg .lt ------------------------------------------------------------------------ DIVQ4 divisor,dividend,quotient,remainder ------------------------------------------------------------------------ .el .b 3 The DIVQ4 procedure will divide one quadword with another quadword and leave the quotient and remainder in two other quadwords. .b After the division is performed, r0 will contain one of the following values: .b .lt -1 if quotient < 0 0 if quotient = 0 1 if quotient > 0 .el .b The DIVQ4 procedure is equivalent to the expression: .b .lt (quoitent,remainder) = divisor / dividend .el .b 2 MLR Example: .b .lt var divr: .blkq 1 divd: .blkq 1 quo: .blkq 1 rem: .blkq 1 external module divq4 divq4 q^divr,q^divd,q^quo,q^rem .el .pg .lt ------------------------------------------------------------------------ MOVQ src,dst ------------------------------------------------------------------------ .el .b 3 The MOVQ procedure will move one quadword to another quadword. .b After the quadword is moved, r0 will contain one of the following values: .b .lt -1 if dst < 0 0 if dst = 0 1 if dst > 0 .el .b The MOVQ procedure is equivalent to the expression: .b .lt dst = src .el .b 2 MLR Example: .b .lt var src: .blkq 1 dst: .blkq 1 external module movq movq q^src,q^dst .el .pg .lt ------------------------------------------------------------------------ MULQ multiplier,product MULQ3 multiplier,multipland,product ------------------------------------------------------------------------ .el .b 3 The MULQ procedure will multiply one quadword with another and leave the result in the second quadword. The MULQ3 procedure will multiply one quadword with another and leave the result in a third quadword. .b After the multiplication is performed, r0 will contain one of the following values: .b .lt -1 if product < 0 0 if product = 0 1 if product > 0 .el .b The MULQ macro is equivalent to the expression: .b .lt product = multiplier * product .el .b and the MULQ3 macro is equivalent to the expression: .b .lt product = multiplier * multipland .el .b 2 MLR Example: .b .lt var mulr: .blkq 1 muld: .blkq 1 prod: .blkq 1 external module mulq external module mulq3 mulq q^mulr,q^prod mulq3 q^mulr,q^muld,q^prod .el .pg .lt ------------------------------------------------------------------------ SUBQ sub,dif SUBQ3 sub,min,dif ------------------------------------------------------------------------ .el .b 3 The SUBQ procedure will subtract one quadword from another and leave the result in the second quadword. The SUBQ3 procedure will subtract one quadword from another and leave the result in a third quadword. .b After the subtraction is performed, r0 will contain one of the following values: .b .lt -1 if dif < 0 0 if dif = 0 1 if dif > 0 .el .b The SUBQ macro is equivalent to the expression: .b .lt dif = sub - dif .el .b and the SUBQ3 macro is equivalent to the expression: .b .lt dif = sub - min .el .b 2 MLR Example: .b .lt var sub: .blkq 1 min: .blkq 1 dif: .blkq 1 external module subq external module subq3 subq q^sub,q^dif subq3 q^sub,q^min,q^dif .el .pg .lt ------------------------------------------------------------------------ TSTQ dst ------------------------------------------------------------------------ .el .b 3 The TSTQ procedure will test a quadword with zero. .b After the test is performed, r0 will contain one of the following values: .b .lt -1 if dst < 0 0 if dst = 0 1 if dst > 0 .el .b 2 MLR Example: .b .lt var src: .blkq 1 external module tstq tstq q^src .el .pg .c;^*References\* .b 2 .ls .le;^*VAX MACRO AND INSTRUCTION SET REFERENCE MANUAL\*, Digital Equipment Corporation, September 1984. (AA-Z700A-TE) .le;^*VAX ARCHITECTURE HANDBOOK\*, Digital Equipment Corporation. .le;^*QUADMATH - Quadword Math\*, HUGHES AIRCRAFT DECUS SIG tape submission. [VAX83C.HUGHES] .els