1/* MIPS3 submul_1 -- Multiply a limb vector with a single limb and 2 * subtract the product from a second limb vector. 3 * 4 * Copyright (C) 1992, 1994, 1995, 1998, 2000 5 * 2001 Free Software Foundation, Inc. 6 * 7 * This file is part of GnuPG. 8 * 9 * GnuPG is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * GnuPG is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 24/******************* 25 * mpi_limb_t 26 * mpihelp_submul_1( mpi_ptr_t res_ptr, (r4) 27 * mpi_ptr_t s1_ptr, (r5) 28 * mpi_size_t s1_size, (r6) 29 * mpi_limb_t s2_limb) (r7) 30 */ 31 32 .text 33 .align 4 34 .globl mpihelp_submul_1 35 .ent mpihelp_submul_1 36mpihelp_submul_1: 37 .set noreorder 38 .set nomacro 39 40/* # warm up phase 0 */ 41 ld $8,0($5) 42 43/* # warm up phase 1 */ 44 daddiu $5,$5,8 45 dmultu $8,$7 46 47 daddiu $6,$6,-1 48 beq $6,$0,$LC0 49 move $2,$0 # zero cy2 50 51 daddiu $6,$6,-1 52 beq $6,$0,$LC1 53 ld $8,0($5) # load new s1 limb as early as possible 54 55Loop: ld $10,0($4) 56 mflo $3 57 mfhi $9 58 daddiu $5,$5,8 59 daddu $3,$3,$2 # add old carry limb to low product limb 60 dmultu $8,$7 61 ld $8,0($5) # load new s1 limb as early as possible 62 daddiu $6,$6,-1 # decrement loop counter 63 sltu $2,$3,$2 # carry from previous addition -> $2 64 dsubu $3,$10,$3 65 sgtu $10,$3,$10 66 daddu $2,$2,$10 67 sd $3,0($4) 68 daddiu $4,$4,8 69 bne $6,$0,Loop 70 daddu $2,$9,$2 # add high product limb and carry from addition 71 72/* # cool down phase 1 */ 73$LC1: ld $10,0($4) 74 mflo $3 75 mfhi $9 76 daddu $3,$3,$2 77 sltu $2,$3,$2 78 dmultu $8,$7 79 dsubu $3,$10,$3 80 sgtu $10,$3,$10 81 daddu $2,$2,$10 82 sd $3,0($4) 83 daddiu $4,$4,8 84 daddu $2,$9,$2 # add high product limb and carry from addition 85 86/* # cool down phase 0 */ 87$LC0: ld $10,0($4) 88 mflo $3 89 mfhi $9 90 daddu $3,$3,$2 91 sltu $2,$3,$2 92 dsubu $3,$10,$3 93 sgtu $10,$3,$10 94 daddu $2,$2,$10 95 sd $3,0($4) 96 j $31 97 daddu $2,$9,$2 # add high product limb and carry from addition 98 99 .end mpihelp_submul_1 100 101