diff options
Diffstat (limited to 'linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-add1.S')
-rw-r--r--[-rwxr-xr-x] | linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-add1.S | 272 |
1 files changed, 136 insertions, 136 deletions
diff --git a/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-add1.S b/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-add1.S index bfc2c01..1661f5e 100755..100644 --- a/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-add1.S +++ b/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-add1.S | |||
@@ -1,136 +1,136 @@ | |||
1 | /* PowerPC-32 add_n -- Add two limb vectors of equal, non-zero length. | 1 | /* PowerPC-32 add_n -- Add two limb vectors of equal, non-zero length. |
2 | * | 2 | * |
3 | * Copyright (C) 1992, 1994, 1995, 1998, 2002 Free Software Foundation, Inc. | 3 | * Copyright (C) 1992, 1994, 1995, 1998, 2002 Free Software Foundation, Inc. |
4 | * | 4 | * |
5 | * This file is part of Libgcrypt. | 5 | * This file is part of Libgcrypt. |
6 | * | 6 | * |
7 | * Libgcrypt is free software; you can redistribute it and/or modify | 7 | * Libgcrypt is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU Lesser General Public License as | 8 | * it under the terms of the GNU Lesser General Public License as |
9 | * published by the Free Software Foundation; either version 2.1 of | 9 | * published by the Free Software Foundation; either version 2.1 of |
10 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * Libgcrypt is distributed in the hope that it will be useful, | 12 | * Libgcrypt is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU Lesser General Public License for more details. | 15 | * GNU Lesser General Public License for more details. |
16 | * | 16 | * |
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this program; if not, write to the Free Software | 18 | * License along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "sysdep.h" | 22 | #include "sysdep.h" |
23 | #include "asm-syntax.h" | 23 | #include "asm-syntax.h" |
24 | 24 | ||
25 | 25 | ||
26 | #ifndef USE_PPC_PATCHES | 26 | #ifndef USE_PPC_PATCHES |
27 | 27 | ||
28 | /******************* | 28 | /******************* |
29 | * mpi_limb_t | 29 | * mpi_limb_t |
30 | * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (r3) | 30 | * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (r3) |
31 | * mpi_ptr_t s1_ptr, (r4) | 31 | * mpi_ptr_t s1_ptr, (r4) |
32 | * mpi_ptr_t s2_ptr, (r5) | 32 | * mpi_ptr_t s2_ptr, (r5) |
33 | * mpi_size_t size) (r6) | 33 | * mpi_size_t size) (r6) |
34 | */ | 34 | */ |
35 | 35 | ||
36 | .toc | 36 | .toc |
37 | .extern _gcry_mpih_add_n[DS] | 37 | .extern _gcry_mpih_add_n[DS] |
38 | .extern ._gcry_mpih_add_n | 38 | .extern ._gcry_mpih_add_n |
39 | .csect [PR] | 39 | .csect [PR] |
40 | .align 2 | 40 | .align 2 |
41 | .globl _gcry_mpih_add_n | 41 | .globl _gcry_mpih_add_n |
42 | .globl ._gcry_mpih_add_n | 42 | .globl ._gcry_mpih_add_n |
43 | .csect _gcry_mpih_add_n[DS] | 43 | .csect _gcry_mpih_add_n[DS] |
44 | _gcry_mpih_add_n: | 44 | _gcry_mpih_add_n: |
45 | .long ._gcry_mpih_add_n, TOC[tc0], 0 | 45 | .long ._gcry_mpih_add_n, TOC[tc0], 0 |
46 | .csect [PR] | 46 | .csect [PR] |
47 | ._gcry_mpih_add_n: | 47 | ._gcry_mpih_add_n: |
48 | mtctr 6 # copy size into CTR | 48 | mtctr 6 # copy size into CTR |
49 | lwz 8,0(4) # load least significant s1 limb | 49 | lwz 8,0(4) # load least significant s1 limb |
50 | lwz 0,0(5) # load least significant s2 limb | 50 | lwz 0,0(5) # load least significant s2 limb |
51 | addi 3,3,-4 # offset res_ptr, it is updated before used | 51 | addi 3,3,-4 # offset res_ptr, it is updated before used |
52 | addc 7,0,8 # add least significant limbs, set cy | 52 | addc 7,0,8 # add least significant limbs, set cy |
53 | bdz Lend # If done, skip loop | 53 | bdz Lend # If done, skip loop |
54 | Loop: lwzu 8,4(4) # load s1 limb and update s1_ptr | 54 | Loop: lwzu 8,4(4) # load s1 limb and update s1_ptr |
55 | lwzu 0,4(5) # load s2 limb and update s2_ptr | 55 | lwzu 0,4(5) # load s2 limb and update s2_ptr |
56 | stwu 7,4(3) # store previous limb in load latency slot | 56 | stwu 7,4(3) # store previous limb in load latency slot |
57 | adde 7,0,8 # add new limbs with cy, set cy | 57 | adde 7,0,8 # add new limbs with cy, set cy |
58 | bdnz Loop # decrement CTR and loop back | 58 | bdnz Loop # decrement CTR and loop back |
59 | Lend: stw 7,4(3) # store ultimate result limb | 59 | Lend: stw 7,4(3) # store ultimate result limb |
60 | li 3,0 # load cy into ... | 60 | li 3,0 # load cy into ... |
61 | addze 3,3 # ... return value register | 61 | addze 3,3 # ... return value register |
62 | blr | 62 | blr |
63 | 63 | ||
64 | #else | 64 | #else |
65 | /* Add two limb vectors of equal, non-zero length for PowerPC. | 65 | /* Add two limb vectors of equal, non-zero length for PowerPC. |
66 | Copyright (C) 1997 Free Software Foundation, Inc. | 66 | Copyright (C) 1997 Free Software Foundation, Inc. |
67 | This file is part of the GNU C Library. | 67 | This file is part of the GNU C Library. |
68 | 68 | ||
69 | The GNU C Library is free software; you can redistribute it and/or | 69 | The GNU C Library is free software; you can redistribute it and/or |
70 | modify it under the terms of the GNU Library General Public License as | 70 | modify it under the terms of the GNU Library General Public License as |
71 | published by the Free Software Foundation; either version 2 of the | 71 | published by the Free Software Foundation; either version 2 of the |
72 | License, or (at your option) any later version. | 72 | License, or (at your option) any later version. |
73 | 73 | ||
74 | The GNU C Library is distributed in the hope that it will be useful, | 74 | The GNU C Library is distributed in the hope that it will be useful, |
75 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 75 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
76 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 76 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
77 | Library General Public License for more details. | 77 | Library General Public License for more details. |
78 | 78 | ||
79 | You should have received a copy of the GNU Library General Public | 79 | You should have received a copy of the GNU Library General Public |
80 | License along with the GNU C Library; see the file COPYING.LIB. If not, | 80 | License along with the GNU C Library; see the file COPYING.LIB. If not, |
81 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 81 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
82 | Boston, MA 02111-1307, USA. */ | 82 | Boston, MA 02111-1307, USA. */ |
83 | 83 | ||
84 | #include "sysdep.h" | 84 | #include "sysdep.h" |
85 | #include "asm-syntax.h" | 85 | #include "asm-syntax.h" |
86 | 86 | ||
87 | 87 | ||
88 | /* mp_limb_t mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, | 88 | /* mp_limb_t mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, |
89 | mp_size_t size) | 89 | mp_size_t size) |
90 | Calculate s1+s2 and put result in res_ptr; return carry, 0 or 1. */ | 90 | Calculate s1+s2 and put result in res_ptr; return carry, 0 or 1. */ |
91 | 91 | ||
92 | /* Note on optimisation: This code is optimal for the 601. Almost every other | 92 | /* Note on optimisation: This code is optimal for the 601. Almost every other |
93 | possible 2-unrolled inner loop will not be. Also, watch out for the | 93 | possible 2-unrolled inner loop will not be. Also, watch out for the |
94 | alignment... */ | 94 | alignment... */ |
95 | 95 | ||
96 | EALIGN(_gcry_mpih_add_n,3,0) | 96 | EALIGN(_gcry_mpih_add_n,3,0) |
97 | /* Set up for loop below. */ | 97 | /* Set up for loop below. */ |
98 | mtcrf 0x01,%r6 | 98 | mtcrf 0x01,%r6 |
99 | srwi. %r7,%r6,1 | 99 | srwi. %r7,%r6,1 |
100 | li %r10,0 | 100 | li %r10,0 |
101 | mtctr %r7 | 101 | mtctr %r7 |
102 | bt 31,2f | 102 | bt 31,2f |
103 | 103 | ||
104 | /* Clear the carry. */ | 104 | /* Clear the carry. */ |
105 | addic %r0,%r0,0 | 105 | addic %r0,%r0,0 |
106 | /* Adjust pointers for loop. */ | 106 | /* Adjust pointers for loop. */ |
107 | addi %r3,%r3,-4 | 107 | addi %r3,%r3,-4 |
108 | addi %r4,%r4,-4 | 108 | addi %r4,%r4,-4 |
109 | addi %r5,%r5,-4 | 109 | addi %r5,%r5,-4 |
110 | b 0f | 110 | b 0f |
111 | 111 | ||
112 | 2: lwz %r7,0(%r5) | 112 | 2: lwz %r7,0(%r5) |
113 | lwz %r6,0(%r4) | 113 | lwz %r6,0(%r4) |
114 | addc %r6,%r6,%r7 | 114 | addc %r6,%r6,%r7 |
115 | stw %r6,0(%r3) | 115 | stw %r6,0(%r3) |
116 | beq 1f | 116 | beq 1f |
117 | 117 | ||
118 | /* The loop. */ | 118 | /* The loop. */ |
119 | 119 | ||
120 | /* Align start of loop to an odd word boundary to guarantee that the | 120 | /* Align start of loop to an odd word boundary to guarantee that the |
121 | last two words can be fetched in one access (for 601). */ | 121 | last two words can be fetched in one access (for 601). */ |
122 | 0: lwz %r9,4(%r4) | 122 | 0: lwz %r9,4(%r4) |
123 | lwz %r8,4(%r5) | 123 | lwz %r8,4(%r5) |
124 | lwzu %r6,8(%r4) | 124 | lwzu %r6,8(%r4) |
125 | lwzu %r7,8(%r5) | 125 | lwzu %r7,8(%r5) |
126 | adde %r8,%r9,%r8 | 126 | adde %r8,%r9,%r8 |
127 | stw %r8,4(%r3) | 127 | stw %r8,4(%r3) |
128 | adde %r6,%r6,%r7 | 128 | adde %r6,%r6,%r7 |
129 | stwu %r6,8(%r3) | 129 | stwu %r6,8(%r3) |
130 | bdnz 0b | 130 | bdnz 0b |
131 | /* Return the carry. */ | 131 | /* Return the carry. */ |
132 | 1: addze %r3,%r10 | 132 | 1: addze %r3,%r10 |
133 | blr | 133 | blr |
134 | END(_gcry_mpih_add_n) | 134 | END(_gcry_mpih_add_n) |
135 | #endif | 135 | #endif |
136 | 136 | ||