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