Add a bad-case test for the key generation.
[libgcrypt.git] / mpi / pa7100 / mpih-lshift.S
1 /* hppa   lshift
2  *        optimized for the PA7100, where it runs at 3.25 cycles/limb
3  * 
4  *      Copyright (C) 1992, 1994, 1998, 
5  *                    2001, 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
25
26 /*******************
27  * mpi_limb_t
28  * _gcry_mpih_lshift( mpi_ptr_t wp,     (gr26)
29  *                 mpi_ptr_t up,        (gr25)
30  *                 mpi_size_t usize,    (gr24)
31  *                 unsigned cnt)        (gr23)
32  */
33
34         .code
35         .export         _gcry_mpih_lshift
36         .label          _gcry_mpih_lshift
37         .proc
38         .callinfo       frame=64,no_calls
39         .entry
40
41         sh2add          %r24,%r25,%r25
42         sh2add          %r24,%r26,%r26
43         ldws,mb         -4(0,%r25),%r22
44         subi            32,%r23,%r1
45         mtsar           %r1
46         addib,=         -1,%r24,L$0004
47         vshd            %r0,%r22,%r28           ; compute carry out limb
48         ldws,mb         -4(0,%r25),%r29
49         addib,<=        -5,%r24,L$rest
50         vshd            %r22,%r29,%r20
51
52         .label  L$loop
53         ldws,mb         -4(0,%r25),%r22
54         stws,mb         %r20,-4(0,%r26)
55         vshd            %r29,%r22,%r20
56         ldws,mb         -4(0,%r25),%r29
57         stws,mb         %r20,-4(0,%r26)
58         vshd            %r22,%r29,%r20
59         ldws,mb         -4(0,%r25),%r22
60         stws,mb         %r20,-4(0,%r26)
61         vshd            %r29,%r22,%r20
62         ldws,mb         -4(0,%r25),%r29
63         stws,mb         %r20,-4(0,%r26)
64         addib,>         -4,%r24,L$loop
65         vshd            %r22,%r29,%r20
66
67         .label  L$rest
68         addib,=         4,%r24,L$end1
69         nop
70         .label  L$eloop
71         ldws,mb         -4(0,%r25),%r22
72         stws,mb         %r20,-4(0,%r26)
73         addib,<=        -1,%r24,L$end2
74         vshd            %r29,%r22,%r20
75         ldws,mb         -4(0,%r25),%r29
76         stws,mb         %r20,-4(0,%r26)
77         addib,>         -1,%r24,L$eloop
78         vshd            %r22,%r29,%r20
79
80         .label  L$end1
81         stws,mb         %r20,-4(0,%r26)
82         vshd            %r29,%r0,%r20
83         bv              0(%r2)
84         stw             %r20,-4(0,%r26)
85         .label  L$end2
86         stws,mb         %r20,-4(0,%r26)
87         .label  L$0004
88         vshd            %r22,%r0,%r20
89         bv              0(%r2)
90         stw             %r20,-4(0,%r26)
91
92         .exit
93         .procend
94
95
96