1/* mips3 lshift 2 * 3 * Copyright (C) 1995, 1998, 2000, 4 * 2001, 2002 Free Software Foundation, Inc. 5 * 6 * This file is part of Libgcrypt. 7 * 8 * Libgcrypt is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as 10 * published by the Free Software Foundation; either version 2.1 of 11 * the License, or (at your option) any later version. 12 * 13 * Libgcrypt is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 21 */ 22 23/******************* 24 * mpi_limb_t 25 * _gcry_mpih_lshift( mpi_ptr_t wp, ($4) 26 * mpi_ptr_t up, ($5) 27 * mpi_size_t usize, ($6) 28 * unsigned cnt) ($7) 29 */ 30 31 .text 32 .align 2 33 .globl _gcry_mpih_lshift 34 .ent _gcry_mpih_lshift 35_gcry_mpih_lshift: 36 .set noreorder 37 .set nomacro 38 39 dsll $2,$6,3 40 daddu $5,$5,$2 # make r5 point at end of src 41 ld $10,-8($5) # load first limb 42 dsubu $13,$0,$7 43 daddu $4,$4,$2 # make r4 point at end of res 44 daddiu $6,$6,-1 45 and $9,$6,4-1 # number of limbs in first loop 46 beq $9,$0,.L0 # if multiple of 4 limbs, skip first loop 47 dsrl $2,$10,$13 # compute function result 48 49 dsubu $6,$6,$9 50 51.Loop0: ld $3,-16($5) 52 daddiu $4,$4,-8 53 daddiu $5,$5,-8 54 daddiu $9,$9,-1 55 dsll $11,$10,$7 56 dsrl $12,$3,$13 57 move $10,$3 58 or $8,$11,$12 59 bne $9,$0,.Loop0 60 sd $8,0($4) 61 62.L0: beq $6,$0,.Lend 63 nop 64 65.Loop: ld $3,-16($5) 66 daddiu $4,$4,-32 67 daddiu $6,$6,-4 68 dsll $11,$10,$7 69 dsrl $12,$3,$13 70 71 ld $10,-24($5) 72 dsll $14,$3,$7 73 or $8,$11,$12 74 sd $8,24($4) 75 dsrl $9,$10,$13 76 77 ld $3,-32($5) 78 dsll $11,$10,$7 79 or $8,$14,$9 80 sd $8,16($4) 81 dsrl $12,$3,$13 82 83 ld $10,-40($5) 84 dsll $14,$3,$7 85 or $8,$11,$12 86 sd $8,8($4) 87 dsrl $9,$10,$13 88 89 daddiu $5,$5,-32 90 or $8,$14,$9 91 bgtz $6,.Loop 92 sd $8,0($4) 93 94.Lend: dsll $8,$10,$7 95 j $31 96 sd $8,-8($4) 97 .end _gcry_mpih_lshift 98