| 1 |
/* Alpha sub_n -- Subtract two limb vectors of the same length > 0 and |
| 2 |
* store difference in a third limb vector. |
| 3 |
* Copyright (C) 1995, 1998, |
| 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, see <https://www.gnu.org/licenses/>. |
| 20 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 21 |
*/ |
| 22 |
|
| 23 |
|
| 24 |
/******************* |
| 25 |
* mpi_limb_t |
| 26 |
* _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (r16) |
| 27 |
* mpi_ptr_t s1_ptr, (r17) |
| 28 |
* mpi_ptr_t s2_ptr, (r18) |
| 29 |
* mpi_size_t size) (r19) |
| 30 |
*/ |
| 31 |
|
| 32 |
.set noreorder |
| 33 |
.set noat |
| 34 |
.text |
| 35 |
.align 3 |
| 36 |
.globl _gcry_mpih_sub_n |
| 37 |
.ent _gcry_mpih_sub_n |
| 38 |
_gcry_mpih_sub_n: |
| 39 |
.frame $30,0,$26,0 |
| 40 |
|
| 41 |
ldq $3,0($17) |
| 42 |
ldq $4,0($18) |
| 43 |
|
| 44 |
subq $19,1,$19 |
| 45 |
and $19,4-1,$2 # number of limbs in first loop |
| 46 |
bis $31,$31,$0 |
| 47 |
beq $2,.L0 # if multiple of 4 limbs, skip first loop |
| 48 |
|
| 49 |
subq $19,$2,$19 |
| 50 |
|
| 51 |
.Loop0: subq $2,1,$2 |
| 52 |
ldq $5,8($17) |
| 53 |
addq $4,$0,$4 |
| 54 |
ldq $6,8($18) |
| 55 |
cmpult $4,$0,$1 |
| 56 |
subq $3,$4,$4 |
| 57 |
cmpult $3,$4,$0 |
| 58 |
stq $4,0($16) |
| 59 |
or $0,$1,$0 |
| 60 |
|
| 61 |
addq $17,8,$17 |
| 62 |
addq $18,8,$18 |
| 63 |
bis $5,$5,$3 |
| 64 |
bis $6,$6,$4 |
| 65 |
addq $16,8,$16 |
| 66 |
bne $2,.Loop0 |
| 67 |
|
| 68 |
.L0: beq $19,.Lend |
| 69 |
|
| 70 |
.align 3 |
| 71 |
.Loop: subq $19,4,$19 |
| 72 |
|
| 73 |
ldq $5,8($17) |
| 74 |
addq $4,$0,$4 |
| 75 |
ldq $6,8($18) |
| 76 |
cmpult $4,$0,$1 |
| 77 |
subq $3,$4,$4 |
| 78 |
cmpult $3,$4,$0 |
| 79 |
stq $4,0($16) |
| 80 |
or $0,$1,$0 |
| 81 |
|
| 82 |
ldq $3,16($17) |
| 83 |
addq $6,$0,$6 |
| 84 |
ldq $4,16($18) |
| 85 |
cmpult $6,$0,$1 |
| 86 |
subq $5,$6,$6 |
| 87 |
cmpult $5,$6,$0 |
| 88 |
stq $6,8($16) |
| 89 |
or $0,$1,$0 |
| 90 |
|
| 91 |
ldq $5,24($17) |
| 92 |
addq $4,$0,$4 |
| 93 |
ldq $6,24($18) |
| 94 |
cmpult $4,$0,$1 |
| 95 |
subq $3,$4,$4 |
| 96 |
cmpult $3,$4,$0 |
| 97 |
stq $4,16($16) |
| 98 |
or $0,$1,$0 |
| 99 |
|
| 100 |
ldq $3,32($17) |
| 101 |
addq $6,$0,$6 |
| 102 |
ldq $4,32($18) |
| 103 |
cmpult $6,$0,$1 |
| 104 |
subq $5,$6,$6 |
| 105 |
cmpult $5,$6,$0 |
| 106 |
stq $6,24($16) |
| 107 |
or $0,$1,$0 |
| 108 |
|
| 109 |
addq $17,32,$17 |
| 110 |
addq $18,32,$18 |
| 111 |
addq $16,32,$16 |
| 112 |
bne $19,.Loop |
| 113 |
|
| 114 |
.Lend: addq $4,$0,$4 |
| 115 |
cmpult $4,$0,$1 |
| 116 |
subq $3,$4,$4 |
| 117 |
cmpult $3,$4,$0 |
| 118 |
stq $4,0($16) |
| 119 |
or $0,$1,$0 |
| 120 |
ret $31,($26),1 |
| 121 |
|
| 122 |
.end _gcry_mpih_sub_n |
| 123 |
|
| 124 |
|