aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S
diff options
context:
space:
mode:
authorJay Threeth2011-04-04 11:48:26 -0700
committerJay Threeth2011-04-04 11:48:26 -0700
commit3c9cc506f741b980565ff5b3b001cd8b6ee36b12 (patch)
treecb862c57b3d5f74177cde3bd962a53fc377166f6 /linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S
parentbuild fixes, might build on linux now (diff)
downloadmeta-impy-3c9cc506f741b980565ff5b3b001cd8b6ee36b12.zip
meta-impy-3c9cc506f741b980565ff5b3b001cd8b6ee36b12.tar.gz
meta-impy-3c9cc506f741b980565ff5b3b001cd8b6ee36b12.tar.bz2
meta-impy-3c9cc506f741b980565ff5b3b001cd8b6ee36b12.tar.xz
add source to libraries, and cruft for building under windows
Diffstat (limited to 'linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S')
-rwxr-xr-xlinden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S120
1 files changed, 120 insertions, 0 deletions
diff --git a/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S b/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S
new file mode 100755
index 0000000..e34f521
--- /dev/null
+++ b/linden/indra/libgcrypt/libgcrypt-1.2.2/mpi/powerpc32/mpih-mul1.S
@@ -0,0 +1,120 @@
1/* PowerPC-32 mul_1 -- Multiply a limb vector with a limb and store
2 * the result in a second limb vector.
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995,
5 * 1998, 2002 Free Software Foundation, Inc.
6 *
7 * This file is part of Libgcrypt.
8 *
9 * Libgcrypt is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
13 *
14 * Libgcrypt 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 Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 */
23
24#include "sysdep.h"
25#include "asm-syntax.h"
26
27
28#ifndef USE_PPC_PATCHES
29
30/*******************
31 * mpi_limb_t
32 * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (r3)
33 * mpi_ptr_t s1_ptr, (r4)
34 * mpi_size_t s1_size, (r5)
35 * mpi_limb_t s2_limb) (r6)
36 *
37 * This is a fairly straightforward implementation. The timing of the PC601
38 * is hard to understand, so I will wait to optimize this until I have some
39 * hardware to play with.
40 *
41 * The code trivially generalizes to 64 bit limbs for the PC620.
42 */
43
44 .toc
45 .csect ._gcry_mpih_mul_1[PR]
46 .align 2
47 .globl _gcry_mpih_mul_1
48 .globl ._gcry_mpih_mul_1
49 .csect _gcry_mpih_mul_1[DS]
50_gcry_mpih_mul_1:
51 .long ._gcry_mpih_mul_1[PR], TOC[tc0], 0
52 .csect ._gcry_mpih_mul_1[PR]
53._gcry_mpih_mul_1:
54 mtctr 5
55
56 lwz 0,0(4)
57 mullw 7,0,6
58 mulhwu 10,0,6
59 addi 3,3,-4 # adjust res_ptr
60 addic 5,5,0 # clear cy with dummy insn
61 bdz Lend
62
63Loop: lwzu 0,4(4)
64 stwu 7,4(3)
65 mullw 8,0,6
66 adde 7,8,10
67 mulhwu 10,0,6
68 bdnz Loop
69
70Lend: stw 7,4(3)
71 addze 3,10
72 blr
73
74#else
75/* Multiply a limb vector by a limb, for PowerPC.
76 Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
77 This file is part of the GNU C Library.
78
79 The GNU C Library is free software; you can redistribute it and/or
80 modify it under the terms of the GNU Library General Public License as
81 published by the Free Software Foundation; either version 2 of the
82 License, or (at your option) any later version.
83
84 The GNU C Library is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 Library General Public License for more details.
88
89 You should have received a copy of the GNU Library General Public
90 License along with the GNU C Library; see the file COPYING.LIB. If not,
91 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
92 Boston, MA 02111-1307, USA. */
93
94
95/* mp_limb_t mpn_mul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr,
96 mp_size_t s1_size, mp_limb_t s2_limb)
97 Calculate s1*s2 and put result in res_ptr; return carry. */
98
99ENTRY(_gcry_mpih_mul_1)
100 mtctr %r5
101
102 lwz %r0,0(%r4)
103 mullw %r7,%r0,%r6
104 mulhwu %r10,%r0,%r6
105 addi %r3,%r3,-4 # adjust res_ptr
106 addic %r5,%r5,0 # clear cy with dummy insn
107 bdz 1f
108
1090: lwzu %r0,4(%r4)
110 stwu %r7,4(%r3)
111 mullw %r8,%r0,%r6
112 adde %r7,%r8,%r10
113 mulhwu %r10,%r0,%r6
114 bdnz 0b
115
1161: stw %r7,4(%r3)
117 addze %r3,%r10
118 blr
119END(_gcry_mpih_mul_1)
120#endif