mul_1.asm revision 1.1.1.1
1dnl MIPS32 mpn_mul_1 -- Multiply a limb vector with a single limb and store 2dnl the product in a second limb vector. 3 4dnl Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc. 5 6dnl This file is part of the GNU MP Library. 7 8dnl The GNU MP Library is free software; you can redistribute it and/or modify 9dnl it under the terms of the GNU Lesser General Public License as published 10dnl by the Free Software Foundation; either version 3 of the License, or (at 11dnl your option) any later version. 12 13dnl The GNU MP Library is distributed in the hope that it will be useful, but 14dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16dnl License for more details. 17 18dnl You should have received a copy of the GNU Lesser General Public License 19dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21include(`../config.m4') 22 23C INPUT PARAMETERS 24C res_ptr $4 25C s1_ptr $5 26C size $6 27C s2_limb $7 28 29ASM_START() 30PROLOGUE(mpn_mul_1) 31 32C feed-in phase 0 33 lw $8,0($5) 34 35C feed-in phase 1 36 addiu $5,$5,4 37 multu $8,$7 38 39 addiu $6,$6,-1 40 beq $6,$0,$LC0 41 move $2,$0 C zero cy2 42 43 addiu $6,$6,-1 44 beq $6,$0,$LC1 45 lw $8,0($5) C load new s1 limb as early as possible 46 47Loop: mflo $10 48 mfhi $9 49 addiu $5,$5,4 50 addu $10,$10,$2 C add old carry limb to low product limb 51 multu $8,$7 52 lw $8,0($5) C load new s1 limb as early as possible 53 addiu $6,$6,-1 C decrement loop counter 54 sltu $2,$10,$2 C carry from previous addition -> $2 55 sw $10,0($4) 56 addiu $4,$4,4 57 bne $6,$0,Loop 58 addu $2,$9,$2 C add high product limb and carry from addition 59 60C wind-down phase 1 61$LC1: mflo $10 62 mfhi $9 63 addu $10,$10,$2 64 sltu $2,$10,$2 65 multu $8,$7 66 sw $10,0($4) 67 addiu $4,$4,4 68 addu $2,$9,$2 C add high product limb and carry from addition 69 70C wind-down phase 0 71$LC0: mflo $10 72 mfhi $9 73 addu $10,$10,$2 74 sltu $2,$10,$2 75 sw $10,0($4) 76 j $31 77 addu $2,$9,$2 C add high product limb and carry from addition 78EPILOGUE(mpn_mul_1) 79