michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: /* michael@0: * michael@0: * This PA-RISC 2.0 function computes the product of two unsigned integers, michael@0: * and adds the result to a previously computed integer. The multiplicand michael@0: * is a 512-bit (64-byte, eight doubleword) unsigned integer, stored in michael@0: * memory in little-double-wordian order. The multiplier is an unsigned michael@0: * 64-bit integer. The previously computed integer to which the product is michael@0: * added is located in the result ("res") area, and is assumed to be a michael@0: * 576-bit (72-byte, nine doubleword) unsigned integer, stored in memory michael@0: * in little-double-wordian order. This value normally will be the result michael@0: * of a previously computed nine doubleword result. It is not necessary michael@0: * to pad the multiplicand with an additional 64-bit zero doubleword. michael@0: * michael@0: * Multiplicand, multiplier, and addend ideally should be aligned at michael@0: * 16-byte boundaries for best performance. The code will function michael@0: * correctly for alignment at eight-byte boundaries which are not 16-byte michael@0: * boundaries, but the execution may be slightly slower due to even/odd michael@0: * bank conflicts on PA-RISC 8000 processors. michael@0: * michael@0: * This function is designed to accept the same calling sequence as Bill michael@0: * Ackerman's "maxpy_little" function. The carry from the ninth doubleword michael@0: * of the result is written to the tenth word of the result, as is done by michael@0: * Bill Ackerman's function. The final carry also is returned as an michael@0: * integer, which may be ignored. The function prototype may be either michael@0: * of the following: michael@0: * michael@0: * void multacc512( int l, chunk* m, const chunk* a, chunk* res ); michael@0: * or michael@0: * int multacc512( int l, chunk* m, const chunk* a, chunk* res ); michael@0: * michael@0: * where: "l" originally denoted vector lengths. This parameter is michael@0: * ignored. This function always assumes a multiplicand length of michael@0: * 512 bits (eight doublewords), and addend and result lengths of michael@0: * 576 bits (nine doublewords). michael@0: * michael@0: * "m" is a pointer to the doubleword multiplier, ideally aligned michael@0: * on a 16-byte boundary. michael@0: * michael@0: * "a" is a pointer to the eight-doubleword multiplicand, stored michael@0: * in little-double-wordian order, and ideally aligned on a 16-byte michael@0: * boundary. michael@0: * michael@0: * "res" is a pointer to the nine doubleword addend, and to the michael@0: * nine-doubleword product computed by this function. The result michael@0: * also is stored in little-double-wordian order, and ideally is michael@0: * aligned on a 16-byte boundary. It is expected that the alignment michael@0: * of the "res" area may alternate between even/odd doubleword michael@0: * boundaries for successive calls for 512-bit x 512-bit michael@0: * multiplications. michael@0: * michael@0: * The code for this function has been scheduled to use the parallelism michael@0: * of the PA-RISC 8000 series microprocessors as well as the author was michael@0: * able. Comments and/or suggestions for improvement are welcomed. michael@0: * michael@0: * The code is "64-bit safe". This means it may be called in either michael@0: * the 32ILP context or the 64LP context. All 64-bits of registers are michael@0: * saved and restored. michael@0: * michael@0: * This code is self-contained. It requires no other header files in order michael@0: * to compile and to be linkable on a PA-RISC 2.0 machine. Symbolic michael@0: * definitions for registers and stack offsets are included within this michael@0: * one source file. michael@0: * michael@0: * This is a leaf routine. As such, minimal use is made of the stack area. michael@0: * Of the 192 bytes allocated, 64 bytes are used for saving/restoring eight michael@0: * general registers, and 128 bytes are used to move intermediate products michael@0: * from the floating-point registers to the general registers. Stack michael@0: * protocols assure proper alignment of these areas. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /* ====================================================================*/ michael@0: /* symbolic definitions for PA-RISC registers */ michael@0: /* in the MIPS style, avoids lots of case shifts */ michael@0: /* assigments (except t4) preserve register number parity */ michael@0: /* ====================================================================*/ michael@0: michael@0: #define zero %r0 /* permanent zero */ michael@0: #define t5 %r1 /* temp register, altered by addil */ michael@0: michael@0: #define rp %r2 /* return pointer */ michael@0: michael@0: #define s1 %r3 /* callee saves register*/ michael@0: #define s0 %r4 /* callee saves register*/ michael@0: #define s3 %r5 /* callee saves register*/ michael@0: #define s2 %r6 /* callee saves register*/ michael@0: #define s5 %r7 /* callee saves register*/ michael@0: #define s4 %r8 /* callee saves register*/ michael@0: #define s7 %r9 /* callee saves register*/ michael@0: #define s6 %r10 /* callee saves register*/ michael@0: michael@0: #define t1 %r19 /* caller saves register*/ michael@0: #define t0 %r20 /* caller saves register*/ michael@0: #define t3 %r21 /* caller saves register*/ michael@0: #define t2 %r22 /* caller saves register*/ michael@0: michael@0: #define a3 %r23 /* fourth argument register, high word */ michael@0: #define a2 %r24 /* third argument register, low word*/ michael@0: #define a1 %r25 /* second argument register, high word*/ michael@0: #define a0 %r26 /* first argument register, low word*/ michael@0: michael@0: #define v0 %r28 /* high order return value*/ michael@0: #define v1 %r29 /* low order return value*/ michael@0: michael@0: #define sp %r30 /* stack pointer*/ michael@0: #define t4 %r31 /* temporary register */ michael@0: michael@0: #define fa0 %fr4 /* first argument register*/ michael@0: #define fa1 %fr5 /* second argument register*/ michael@0: #define fa2 %fr6 /* third argument register*/ michael@0: #define fa3 %fr7 /* fourth argument register*/ michael@0: michael@0: #define fa0r %fr4R /* first argument register*/ michael@0: #define fa1r %fr5R /* second argument register*/ michael@0: #define fa2r %fr6R /* third argument register*/ michael@0: #define fa3r %fr7R /* fourth argument register*/ michael@0: michael@0: #define ft0 %fr8 /* caller saves register*/ michael@0: #define ft1 %fr9 /* caller saves register*/ michael@0: #define ft2 %fr10 /* caller saves register*/ michael@0: #define ft3 %fr11 /* caller saves register*/ michael@0: michael@0: #define ft0r %fr8R /* caller saves register*/ michael@0: #define ft1r %fr9R /* caller saves register*/ michael@0: #define ft2r %fr10R /* caller saves register*/ michael@0: #define ft3r %fr11R /* caller saves register*/ michael@0: michael@0: #define ft4 %fr22 /* caller saves register*/ michael@0: #define ft5 %fr23 /* caller saves register*/ michael@0: #define ft6 %fr24 /* caller saves register*/ michael@0: #define ft7 %fr25 /* caller saves register*/ michael@0: #define ft8 %fr26 /* caller saves register*/ michael@0: #define ft9 %fr27 /* caller saves register*/ michael@0: #define ft10 %fr28 /* caller saves register*/ michael@0: #define ft11 %fr29 /* caller saves register*/ michael@0: #define ft12 %fr30 /* caller saves register*/ michael@0: #define ft13 %fr31 /* caller saves register*/ michael@0: michael@0: #define ft4r %fr22R /* caller saves register*/ michael@0: #define ft5r %fr23R /* caller saves register*/ michael@0: #define ft6r %fr24R /* caller saves register*/ michael@0: #define ft7r %fr25R /* caller saves register*/ michael@0: #define ft8r %fr26R /* caller saves register*/ michael@0: #define ft9r %fr27R /* caller saves register*/ michael@0: #define ft10r %fr28R /* caller saves register*/ michael@0: #define ft11r %fr29R /* caller saves register*/ michael@0: #define ft12r %fr30R /* caller saves register*/ michael@0: #define ft13r %fr31R /* caller saves register*/ michael@0: michael@0: michael@0: michael@0: /* ================================================================== */ michael@0: /* functional definitions for PA-RISC registers */ michael@0: /* ================================================================== */ michael@0: michael@0: /* general registers */ michael@0: michael@0: #define T1 a0 /* temp, (length parameter ignored) */ michael@0: michael@0: #define pM a1 /* -> 64-bit multiplier */ michael@0: #define T2 a1 /* temp, (after fetching multiplier) */ michael@0: michael@0: #define pA a2 /* -> multiplicand vector (8 64-bit words) */ michael@0: #define T3 a2 /* temp, (after fetching multiplicand) */ michael@0: michael@0: #define pR a3 /* -> addend vector (8 64-bit doublewords, michael@0: result vector (9 64-bit words) */ michael@0: michael@0: #define S0 s0 /* callee saves summand registers */ michael@0: #define S1 s1 michael@0: #define S2 s2 michael@0: #define S3 s3 michael@0: #define S4 s4 michael@0: #define S5 s5 michael@0: #define S6 s6 michael@0: #define S7 s7 michael@0: michael@0: #define S8 v0 /* caller saves summand registers */ michael@0: #define S9 v1 michael@0: #define S10 t0 michael@0: #define S11 t1 michael@0: #define S12 t2 michael@0: #define S13 t3 michael@0: #define S14 t4 michael@0: #define S15 t5 michael@0: michael@0: michael@0: michael@0: /* floating-point registers */ michael@0: michael@0: #define M fa0 /* multiplier double word */ michael@0: #define MR fa0r /* low order half of multiplier double word */ michael@0: #define ML fa0 /* high order half of multiplier double word */ michael@0: michael@0: #define A0 fa2 /* multiplicand double word 0 */ michael@0: #define A0R fa2r /* low order half of multiplicand double word */ michael@0: #define A0L fa2 /* high order half of multiplicand double word */ michael@0: michael@0: #define A1 fa3 /* multiplicand double word 1 */ michael@0: #define A1R fa3r /* low order half of multiplicand double word */ michael@0: #define A1L fa3 /* high order half of multiplicand double word */ michael@0: michael@0: #define A2 ft0 /* multiplicand double word 2 */ michael@0: #define A2R ft0r /* low order half of multiplicand double word */ michael@0: #define A2L ft0 /* high order half of multiplicand double word */ michael@0: michael@0: #define A3 ft1 /* multiplicand double word 3 */ michael@0: #define A3R ft1r /* low order half of multiplicand double word */ michael@0: #define A3L ft1 /* high order half of multiplicand double word */ michael@0: michael@0: #define A4 ft2 /* multiplicand double word 4 */ michael@0: #define A4R ft2r /* low order half of multiplicand double word */ michael@0: #define A4L ft2 /* high order half of multiplicand double word */ michael@0: michael@0: #define A5 ft3 /* multiplicand double word 5 */ michael@0: #define A5R ft3r /* low order half of multiplicand double word */ michael@0: #define A5L ft3 /* high order half of multiplicand double word */ michael@0: michael@0: #define A6 ft4 /* multiplicand double word 6 */ michael@0: #define A6R ft4r /* low order half of multiplicand double word */ michael@0: #define A6L ft4 /* high order half of multiplicand double word */ michael@0: michael@0: #define A7 ft5 /* multiplicand double word 7 */ michael@0: #define A7R ft5r /* low order half of multiplicand double word */ michael@0: #define A7L ft5 /* high order half of multiplicand double word */ michael@0: michael@0: #define P0 ft6 /* product word 0 */ michael@0: #define P1 ft7 /* product word 0 */ michael@0: #define P2 ft8 /* product word 0 */ michael@0: #define P3 ft9 /* product word 0 */ michael@0: #define P4 ft10 /* product word 0 */ michael@0: #define P5 ft11 /* product word 0 */ michael@0: #define P6 ft12 /* product word 0 */ michael@0: #define P7 ft13 /* product word 0 */ michael@0: michael@0: michael@0: michael@0: michael@0: /* ====================================================================== */ michael@0: /* symbolic definitions for HP-UX stack offsets */ michael@0: /* symbolic definitions for memory NOPs */ michael@0: /* ====================================================================== */ michael@0: michael@0: #define ST_SZ 192 /* stack area total size */ michael@0: michael@0: #define SV0 -192(sp) /* general register save area */ michael@0: #define SV1 -184(sp) michael@0: #define SV2 -176(sp) michael@0: #define SV3 -168(sp) michael@0: #define SV4 -160(sp) michael@0: #define SV5 -152(sp) michael@0: #define SV6 -144(sp) michael@0: #define SV7 -136(sp) michael@0: michael@0: #define XF0 -128(sp) /* data transfer area */ michael@0: #define XF1 -120(sp) /* for floating-pt to integer regs */ michael@0: #define XF2 -112(sp) michael@0: #define XF3 -104(sp) michael@0: #define XF4 -96(sp) michael@0: #define XF5 -88(sp) michael@0: #define XF6 -80(sp) michael@0: #define XF7 -72(sp) michael@0: #define XF8 -64(sp) michael@0: #define XF9 -56(sp) michael@0: #define XF10 -48(sp) michael@0: #define XF11 -40(sp) michael@0: #define XF12 -32(sp) michael@0: #define XF13 -24(sp) michael@0: #define XF14 -16(sp) michael@0: #define XF15 -8(sp) michael@0: michael@0: #define mnop proberi (sp),3,zero /* memory NOP */ michael@0: michael@0: michael@0: michael@0: michael@0: /* ====================================================================== */ michael@0: /* assembler formalities */ michael@0: /* ====================================================================== */ michael@0: michael@0: #ifdef __LP64__ michael@0: .level 2.0W michael@0: #else michael@0: .level 2.0 michael@0: #endif michael@0: .space $TEXT$ michael@0: .subspa $CODE$ michael@0: .align 16 michael@0: michael@0: /* ====================================================================== */ michael@0: /* here to compute 64-bit x 512-bit product + 512-bit addend */ michael@0: /* ====================================================================== */ michael@0: michael@0: multacc512 michael@0: .PROC michael@0: .CALLINFO michael@0: .ENTRY michael@0: fldd 0(pM),M ; multiplier double word michael@0: ldo ST_SZ(sp),sp ; push stack michael@0: michael@0: fldd 0(pA),A0 ; multiplicand double word 0 michael@0: std S1,SV1 ; save s1 michael@0: michael@0: fldd 16(pA),A2 ; multiplicand double word 2 michael@0: std S3,SV3 ; save s3 michael@0: michael@0: fldd 32(pA),A4 ; multiplicand double word 4 michael@0: std S5,SV5 ; save s5 michael@0: michael@0: fldd 48(pA),A6 ; multiplicand double word 6 michael@0: std S7,SV7 ; save s7 michael@0: michael@0: michael@0: std S0,SV0 ; save s0 michael@0: fldd 8(pA),A1 ; multiplicand double word 1 michael@0: xmpyu MR,A0L,P0 ; A0 cross 32-bit word products michael@0: xmpyu ML,A0R,P2 michael@0: michael@0: std S2,SV2 ; save s2 michael@0: fldd 24(pA),A3 ; multiplicand double word 3 michael@0: xmpyu MR,A2L,P4 ; A2 cross 32-bit word products michael@0: xmpyu ML,A2R,P6 michael@0: michael@0: std S4,SV4 ; save s4 michael@0: fldd 40(pA),A5 ; multiplicand double word 5 michael@0: michael@0: std S6,SV6 ; save s6 michael@0: fldd 56(pA),A7 ; multiplicand double word 7 michael@0: michael@0: michael@0: fstd P0,XF0 ; MR * A0L michael@0: xmpyu MR,A0R,P0 ; A0 right 32-bit word product michael@0: xmpyu MR,A1L,P1 ; A1 cross 32-bit word product michael@0: michael@0: fstd P2,XF2 ; ML * A0R michael@0: xmpyu ML,A0L,P2 ; A0 left 32-bit word product michael@0: xmpyu ML,A1R,P3 ; A1 cross 32-bit word product michael@0: michael@0: fstd P4,XF4 ; MR * A2L michael@0: xmpyu MR,A2R,P4 ; A2 right 32-bit word product michael@0: xmpyu MR,A3L,P5 ; A3 cross 32-bit word product michael@0: michael@0: fstd P6,XF6 ; ML * A2R michael@0: xmpyu ML,A2L,P6 ; A2 parallel 32-bit word product michael@0: xmpyu ML,A3R,P7 ; A3 cross 32-bit word product michael@0: michael@0: michael@0: ldd XF0,S0 ; MR * A0L michael@0: fstd P1,XF1 ; MR * A1L michael@0: michael@0: ldd XF2,S2 ; ML * A0R michael@0: fstd P3,XF3 ; ML * A1R michael@0: michael@0: ldd XF4,S4 ; MR * A2L michael@0: fstd P5,XF5 ; MR * A3L michael@0: xmpyu MR,A1R,P1 ; A1 parallel 32-bit word products michael@0: xmpyu ML,A1L,P3 michael@0: michael@0: ldd XF6,S6 ; ML * A2R michael@0: fstd P7,XF7 ; ML * A3R michael@0: xmpyu MR,A3R,P5 ; A3 parallel 32-bit word products michael@0: xmpyu ML,A3L,P7 michael@0: michael@0: michael@0: fstd P0,XF0 ; MR * A0R michael@0: ldd XF1,S1 ; MR * A1L michael@0: nop michael@0: add S0,S2,T1 ; A0 cross product sum michael@0: michael@0: fstd P2,XF2 ; ML * A0L michael@0: ldd XF3,S3 ; ML * A1R michael@0: add,dc zero,zero,S0 ; A0 cross product sum carry michael@0: depd,z T1,31,32,S2 ; A0 cross product sum << 32 michael@0: michael@0: fstd P4,XF4 ; MR * A2R michael@0: ldd XF5,S5 ; MR * A3L michael@0: shrpd S0,T1,32,S0 ; A0 carry | cross product sum >> 32 michael@0: add S4,S6,T3 ; A2 cross product sum michael@0: michael@0: fstd P6,XF6 ; ML * A2L michael@0: ldd XF7,S7 ; ML * A3R michael@0: add,dc zero,zero,S4 ; A2 cross product sum carry michael@0: depd,z T3,31,32,S6 ; A2 cross product sum << 32 michael@0: michael@0: michael@0: ldd XF0,S8 ; MR * A0R michael@0: fstd P1,XF1 ; MR * A1R michael@0: xmpyu MR,A4L,P0 ; A4 cross 32-bit word product michael@0: xmpyu MR,A5L,P1 ; A5 cross 32-bit word product michael@0: michael@0: ldd XF2,S10 ; ML * A0L michael@0: fstd P3,XF3 ; ML * A1L michael@0: xmpyu ML,A4R,P2 ; A4 cross 32-bit word product michael@0: xmpyu ML,A5R,P3 ; A5 cross 32-bit word product michael@0: michael@0: ldd XF4,S12 ; MR * A2R michael@0: fstd P5,XF5 ; MR * A3L michael@0: xmpyu MR,A6L,P4 ; A6 cross 32-bit word product michael@0: xmpyu MR,A7L,P5 ; A7 cross 32-bit word product michael@0: michael@0: ldd XF6,S14 ; ML * A2L michael@0: fstd P7,XF7 ; ML * A3L michael@0: xmpyu ML,A6R,P6 ; A6 cross 32-bit word product michael@0: xmpyu ML,A7R,P7 ; A7 cross 32-bit word product michael@0: michael@0: michael@0: fstd P0,XF0 ; MR * A4L michael@0: ldd XF1,S9 ; MR * A1R michael@0: shrpd S4,T3,32,S4 ; A2 carry | cross product sum >> 32 michael@0: add S1,S3,T1 ; A1 cross product sum michael@0: michael@0: fstd P2,XF2 ; ML * A4R michael@0: ldd XF3,S11 ; ML * A1L michael@0: add,dc zero,zero,S1 ; A1 cross product sum carry michael@0: depd,z T1,31,32,S3 ; A1 cross product sum << 32 michael@0: michael@0: fstd P4,XF4 ; MR * A6L michael@0: ldd XF5,S13 ; MR * A3R michael@0: shrpd S1,T1,32,S1 ; A1 carry | cross product sum >> 32 michael@0: add S5,S7,T3 ; A3 cross product sum michael@0: michael@0: fstd P6,XF6 ; ML * A6R michael@0: ldd XF7,S15 ; ML * A3L michael@0: add,dc zero,zero,S5 ; A3 cross product sum carry michael@0: depd,z T3,31,32,S7 ; A3 cross product sum << 32 michael@0: michael@0: michael@0: shrpd S5,T3,32,S5 ; A3 carry | cross product sum >> 32 michael@0: add S2,S8,S8 ; M * A0 right doubleword, P0 doubleword michael@0: michael@0: add,dc S0,S10,S10 ; M * A0 left doubleword michael@0: add S3,S9,S9 ; M * A1 right doubleword michael@0: michael@0: add,dc S1,S11,S11 ; M * A1 left doubleword michael@0: add S6,S12,S12 ; M * A2 right doubleword michael@0: michael@0: michael@0: ldd 24(pR),S3 ; Addend word 3 michael@0: fstd P1,XF1 ; MR * A5L michael@0: add,dc S4,S14,S14 ; M * A2 left doubleword michael@0: xmpyu MR,A5R,P1 ; A5 right 32-bit word product michael@0: michael@0: ldd 8(pR),S1 ; Addend word 1 michael@0: fstd P3,XF3 ; ML * A5R michael@0: add S7,S13,S13 ; M * A3 right doubleword michael@0: xmpyu ML,A5L,P3 ; A5 left 32-bit word product michael@0: michael@0: ldd 0(pR),S7 ; Addend word 0 michael@0: fstd P5,XF5 ; MR * A7L michael@0: add,dc S5,S15,S15 ; M * A3 left doubleword michael@0: xmpyu MR,A7R,P5 ; A7 right 32-bit word product michael@0: michael@0: ldd 16(pR),S5 ; Addend word 2 michael@0: fstd P7,XF7 ; ML * A7R michael@0: add S10,S9,S9 ; P1 doubleword michael@0: xmpyu ML,A7L,P7 ; A7 left 32-bit word products michael@0: michael@0: michael@0: ldd XF0,S0 ; MR * A4L michael@0: fstd P1,XF9 ; MR * A5R michael@0: add,dc S11,S12,S12 ; P2 doubleword michael@0: xmpyu MR,A4R,P0 ; A4 right 32-bit word product michael@0: michael@0: ldd XF2,S2 ; ML * A4R michael@0: fstd P3,XF11 ; ML * A5L michael@0: add,dc S14,S13,S13 ; P3 doubleword michael@0: xmpyu ML,A4L,P2 ; A4 left 32-bit word product michael@0: michael@0: ldd XF6,S6 ; ML * A6R michael@0: fstd P5,XF13 ; MR * A7R michael@0: add,dc zero,S15,T2 ; P4 partial doubleword michael@0: xmpyu MR,A6R,P4 ; A6 right 32-bit word product michael@0: michael@0: ldd XF4,S4 ; MR * A6L michael@0: fstd P7,XF15 ; ML * A7L michael@0: add S7,S8,S8 ; R0 + P0, new R0 doubleword michael@0: xmpyu ML,A6L,P6 ; A6 left 32-bit word product michael@0: michael@0: michael@0: fstd P0,XF0 ; MR * A4R michael@0: ldd XF7,S7 ; ML * A7R michael@0: add,dc S1,S9,S9 ; c + R1 + P1, new R1 doubleword michael@0: michael@0: fstd P2,XF2 ; ML * A4L michael@0: ldd XF1,S1 ; MR * A5L michael@0: add,dc S5,S12,S12 ; c + R2 + P2, new R2 doubleword michael@0: michael@0: fstd P4,XF4 ; MR * A6R michael@0: ldd XF5,S5 ; MR * A7L michael@0: add,dc S3,S13,S13 ; c + R3 + P3, new R3 doubleword michael@0: michael@0: fstd P6,XF6 ; ML * A6L michael@0: ldd XF3,S3 ; ML * A5R michael@0: add,dc zero,T2,T2 ; c + partial P4 michael@0: add S0,S2,T1 ; A4 cross product sum michael@0: michael@0: michael@0: std S8,0(pR) ; save R0 michael@0: add,dc zero,zero,S0 ; A4 cross product sum carry michael@0: depd,z T1,31,32,S2 ; A4 cross product sum << 32 michael@0: michael@0: std S9,8(pR) ; save R1 michael@0: shrpd S0,T1,32,S0 ; A4 carry | cross product sum >> 32 michael@0: add S4,S6,T3 ; A6 cross product sum michael@0: michael@0: std S12,16(pR) ; save R2 michael@0: add,dc zero,zero,S4 ; A6 cross product sum carry michael@0: depd,z T3,31,32,S6 ; A6 cross product sum << 32 michael@0: michael@0: michael@0: std S13,24(pR) ; save R3 michael@0: shrpd S4,T3,32,S4 ; A6 carry | cross product sum >> 32 michael@0: add S1,S3,T1 ; A5 cross product sum michael@0: michael@0: ldd XF0,S8 ; MR * A4R michael@0: add,dc zero,zero,S1 ; A5 cross product sum carry michael@0: depd,z T1,31,32,S3 ; A5 cross product sum << 32 michael@0: michael@0: ldd XF2,S10 ; ML * A4L michael@0: ldd XF9,S9 ; MR * A5R michael@0: shrpd S1,T1,32,S1 ; A5 carry | cross product sum >> 32 michael@0: add S5,S7,T3 ; A7 cross product sum michael@0: michael@0: ldd XF4,S12 ; MR * A6R michael@0: ldd XF11,S11 ; ML * A5L michael@0: add,dc zero,zero,S5 ; A7 cross product sum carry michael@0: depd,z T3,31,32,S7 ; A7 cross product sum << 32 michael@0: michael@0: ldd XF6,S14 ; ML * A6L michael@0: ldd XF13,S13 ; MR * A7R michael@0: shrpd S5,T3,32,S5 ; A7 carry | cross product sum >> 32 michael@0: add S2,S8,S8 ; M * A4 right doubleword michael@0: michael@0: michael@0: ldd XF15,S15 ; ML * A7L michael@0: add,dc S0,S10,S10 ; M * A4 left doubleword michael@0: add S3,S9,S9 ; M * A5 right doubleword michael@0: michael@0: add,dc S1,S11,S11 ; M * A5 left doubleword michael@0: add S6,S12,S12 ; M * A6 right doubleword michael@0: michael@0: ldd 32(pR),S0 ; Addend word 4 michael@0: ldd 40(pR),S1 ; Addend word 5 michael@0: add,dc S4,S14,S14 ; M * A6 left doubleword michael@0: add S7,S13,S13 ; M * A7 right doubleword michael@0: michael@0: ldd 48(pR),S2 ; Addend word 6 michael@0: ldd 56(pR),S3 ; Addend word 7 michael@0: add,dc S5,S15,S15 ; M * A7 left doubleword michael@0: add S8,T2,S8 ; P4 doubleword michael@0: michael@0: ldd 64(pR),S4 ; Addend word 8 michael@0: ldd SV5,s5 ; restore s5 michael@0: add,dc S10,S9,S9 ; P5 doubleword michael@0: add,dc S11,S12,S12 ; P6 doubleword michael@0: michael@0: michael@0: ldd SV6,s6 ; restore s6 michael@0: ldd SV7,s7 ; restore s7 michael@0: add,dc S14,S13,S13 ; P7 doubleword michael@0: add,dc zero,S15,S15 ; P8 doubleword michael@0: michael@0: add S0,S8,S8 ; new R4 doubleword michael@0: michael@0: ldd SV0,s0 ; restore s0 michael@0: std S8,32(pR) ; save R4 michael@0: add,dc S1,S9,S9 ; new R5 doubleword michael@0: michael@0: ldd SV1,s1 ; restore s1 michael@0: std S9,40(pR) ; save R5 michael@0: add,dc S2,S12,S12 ; new R6 doubleword michael@0: michael@0: ldd SV2,s2 ; restore s2 michael@0: std S12,48(pR) ; save R6 michael@0: add,dc S3,S13,S13 ; new R7 doubleword michael@0: michael@0: ldd SV3,s3 ; restore s3 michael@0: std S13,56(pR) ; save R7 michael@0: add,dc S4,S15,S15 ; new R8 doubleword michael@0: michael@0: ldd SV4,s4 ; restore s4 michael@0: std S15,64(pR) ; save result[8] michael@0: add,dc zero,zero,v0 ; return carry from R8 michael@0: michael@0: CMPIB,*= 0,v0,$L0 ; if no overflow, exit michael@0: LDO 8(pR),pR michael@0: michael@0: $FINAL1 ; Final carry propagation michael@0: LDD 64(pR),v0 michael@0: LDO 8(pR),pR michael@0: ADDI 1,v0,v0 michael@0: CMPIB,*= 0,v0,$FINAL1 ; Keep looping if there is a carry. michael@0: STD v0,56(pR) michael@0: $L0 michael@0: bv zero(rp) ; -> caller michael@0: ldo -ST_SZ(sp),sp ; pop stack michael@0: michael@0: /* ====================================================================== */ michael@0: /* end of module */ michael@0: /* ====================================================================== */ michael@0: michael@0: michael@0: bve (rp) michael@0: .EXIT michael@0: nop michael@0: .PROCEND michael@0: .SPACE $TEXT$ michael@0: .SUBSPA $CODE$ michael@0: .EXPORT multacc512,ENTRY michael@0: michael@0: .end