1/* MIPS2 __mpn_add_n -- Add two limb vectors of the same length > 0 and 2store sum in a third limb vector. 3 4Copyright (C) 1995-2021 Free Software Foundation, Inc. 5 6This file is part of the GNU MP Library. 7 8The GNU MP Library is free software; you can redistribute it and/or modify 9it under the terms of the GNU Lesser General Public License as published by 10the Free Software Foundation; either version 2.1 of the License, or (at your 11option) any later version. 12 13The GNU MP Library is distributed in the hope that it will be useful, but 14WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16License for more details. 17 18You should have received a copy of the GNU Lesser General Public License 19along with the GNU MP Library. If not, see 20<https://www.gnu.org/licenses/>. */ 21 22#include <sysdep.h> 23 24/* INPUT PARAMETERS 25 res_ptr $4 26 s1_ptr $5 27 s2_ptr $6 28 size $7 29*/ 30#ifdef __PIC__ 31 .option pic2 32#endif 33ENTRY (__mpn_add_n) 34 .set noreorder 35#ifdef __PIC__ 36 .cpload t9 37#endif 38 .set nomacro 39 40 lw $10,0($5) 41 lw $11,0($6) 42 43 addiu $7,$7,-1 44 and $9,$7,4-1 /* number of limbs in first loop */ 45 beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */ 46 move $2,$0 47 48 subu $7,$7,$9 49 50L(Loop0): addiu $9,$9,-1 51 lw $12,4($5) 52 addu $11,$11,$2 53 lw $13,4($6) 54 sltu $8,$11,$2 55 addu $11,$10,$11 56 sltu $2,$11,$10 57 sw $11,0($4) 58 or $2,$2,$8 59 60 addiu $5,$5,4 61 addiu $6,$6,4 62 move $10,$12 63 move $11,$13 64 bne $9,$0,L(Loop0) 65 addiu $4,$4,4 66 67L(L0): beq $7,$0,L(end) 68 nop 69 70L(Loop): addiu $7,$7,-4 71 72 lw $12,4($5) 73 addu $11,$11,$2 74 lw $13,4($6) 75 sltu $8,$11,$2 76 addu $11,$10,$11 77 sltu $2,$11,$10 78 sw $11,0($4) 79 or $2,$2,$8 80 81 lw $10,8($5) 82 addu $13,$13,$2 83 lw $11,8($6) 84 sltu $8,$13,$2 85 addu $13,$12,$13 86 sltu $2,$13,$12 87 sw $13,4($4) 88 or $2,$2,$8 89 90 lw $12,12($5) 91 addu $11,$11,$2 92 lw $13,12($6) 93 sltu $8,$11,$2 94 addu $11,$10,$11 95 sltu $2,$11,$10 96 sw $11,8($4) 97 or $2,$2,$8 98 99 lw $10,16($5) 100 addu $13,$13,$2 101 lw $11,16($6) 102 sltu $8,$13,$2 103 addu $13,$12,$13 104 sltu $2,$13,$12 105 sw $13,12($4) 106 or $2,$2,$8 107 108 addiu $5,$5,16 109 addiu $6,$6,16 110 111 bne $7,$0,L(Loop) 112 addiu $4,$4,16 113 114L(end): addu $11,$11,$2 115 sltu $8,$11,$2 116 addu $11,$10,$11 117 sltu $2,$11,$10 118 sw $11,0($4) 119 j $31 120 or $2,$2,$8 121END (__mpn_add_n) 122