1dnl MIPS32 mpn_add_n -- Add two limb vectors of the same length > 0 and store 2dnl sum in a third limb vector. 3 4dnl Copyright 1995, 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 s2_ptr $6 27C size $7 28 29ASM_START() 30PROLOGUE(mpn_add_n) 31 32 lw $10,0($5) 33 lw $11,0($6) 34 35 addiu $7,$7,-1 36 and $9,$7,4-1 C number of limbs in first loop 37 beq $9,$0,.L0 C if multiple of 4 limbs, skip first loop 38 move $2,$0 39 40 subu $7,$7,$9 41 42.Loop0: addiu $9,$9,-1 43 lw $12,4($5) 44 addu $11,$11,$2 45 lw $13,4($6) 46 sltu $8,$11,$2 47 addu $11,$10,$11 48 sltu $2,$11,$10 49 sw $11,0($4) 50 or $2,$2,$8 51 52 addiu $5,$5,4 53 addiu $6,$6,4 54 move $10,$12 55 move $11,$13 56 bne $9,$0,.Loop0 57 addiu $4,$4,4 58 59.L0: beq $7,$0,.Lend 60 nop 61 62.Loop: addiu $7,$7,-4 63 64 lw $12,4($5) 65 addu $11,$11,$2 66 lw $13,4($6) 67 sltu $8,$11,$2 68 addu $11,$10,$11 69 sltu $2,$11,$10 70 sw $11,0($4) 71 or $2,$2,$8 72 73 lw $10,8($5) 74 addu $13,$13,$2 75 lw $11,8($6) 76 sltu $8,$13,$2 77 addu $13,$12,$13 78 sltu $2,$13,$12 79 sw $13,4($4) 80 or $2,$2,$8 81 82 lw $12,12($5) 83 addu $11,$11,$2 84 lw $13,12($6) 85 sltu $8,$11,$2 86 addu $11,$10,$11 87 sltu $2,$11,$10 88 sw $11,8($4) 89 or $2,$2,$8 90 91 lw $10,16($5) 92 addu $13,$13,$2 93 lw $11,16($6) 94 sltu $8,$13,$2 95 addu $13,$12,$13 96 sltu $2,$13,$12 97 sw $13,12($4) 98 or $2,$2,$8 99 100 addiu $5,$5,16 101 addiu $6,$6,16 102 103 bne $7,$0,.Loop 104 addiu $4,$4,16 105 106.Lend: addu $11,$11,$2 107 sltu $8,$11,$2 108 addu $11,$10,$11 109 sltu $2,$11,$10 110 sw $11,0($4) 111 j $31 112 or $2,$2,$8 113EPILOGUE(mpn_add_n) 114