~ubuntu-branches/ubuntu/feisty/gnupg2/feisty

« back to all changes in this revision

Viewing changes to mpi/powerpc32/mpih-rshift.S

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-07-11 11:38:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060711113813-zaw7unlbuh7gyxtl
Tags: 1.9.21-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* PowerPC-32 rshift
2
 
 *
3
 
 *      Copyright (C) 1995, 1998 Free Software Foundation, Inc.
4
 
 *
5
 
 * This file is part of GnuPG.
6
 
 *
7
 
 * GnuPG is free software; you can redistribute it and/or modify
8
 
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; either version 2 of the License, or
10
 
 * (at your option) any later version.
11
 
 *
12
 
 * GnuPG is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20
 
 */
21
 
 
22
 
 
23
 
#include "sysdep.h"
24
 
#include "asm-syntax.h"
25
 
 
26
 
 
27
 
#ifndef USE_PPC_PATCHES
28
 
 
29
 
/*******************
30
 
 * mpi_limb_t
31
 
 * mpihelp_rshift( mpi_ptr_t wp,        (r3)
32
 
 *                 mpi_ptr_t up,        (r4)
33
 
 *                 mpi_size_t usize,    (r5)
34
 
 *                 unsigned cnt)        (r6)
35
 
 */
36
 
 
37
 
        .toc
38
 
.csect  .text[PR]
39
 
        .align  2
40
 
        .globl  mpihelp_rshift
41
 
        .globl  .mpihelp_rshift
42
 
        .csect  mpihelp_rshift[DS]
43
 
mpihelp_rshift:
44
 
        .long   .mpihelp_rshift,  TOC[tc0],       0
45
 
        .csect  .text[PR]
46
 
.mpihelp_rshift:
47
 
        mtctr   5               # copy size into CTR
48
 
        addi    7,3,-4          # move adjusted res_ptr to free return reg
49
 
        subfic  8,6,32
50
 
        lwz     11,0(4)         # load first s1 limb
51
 
        slw     3,11,8          # compute function return value
52
 
        bdz     Lend1
53
 
 
54
 
Loop:   lwzu    10,4(4)
55
 
        srw     9,11,6
56
 
        slw     12,10,8
57
 
        or      9,9,12
58
 
        stwu    9,4(7)
59
 
        bdz     Lend2
60
 
        lwzu    11,4(4)
61
 
        srw     9,10,6
62
 
        slw     12,11,8
63
 
        or      9,9,12
64
 
        stwu    9,4(7)
65
 
        bdnz    Loop
66
 
 
67
 
Lend1:  srw     0,11,6
68
 
        stw     0,4(7)
69
 
        blr
70
 
 
71
 
Lend2:  srw     0,10,6
72
 
        stw     0,4(7)
73
 
        blr
74
 
 
75
 
#else
76
 
/* Shift a limb right, low level routine.
77
 
   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
78
 
   This file is part of the GNU C Library.
79
 
 
80
 
   The GNU C Library is free software; you can redistribute it and/or
81
 
   modify it under the terms of the GNU Library General Public License as
82
 
   published by the Free Software Foundation; either version 2 of the
83
 
   License, or (at your option) any later version.
84
 
 
85
 
   The GNU C Library is distributed in the hope that it will be useful,
86
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
87
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
88
 
   Library General Public License for more details.
89
 
 
90
 
   You should have received a copy of the GNU Library General Public
91
 
   License along with the GNU C Library; see the file COPYING.LIB.  If not,
92
 
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
93
 
   Boston, MA 02111-1307, USA.  */
94
 
 
95
 
 
96
 
/* INPUT PARAMETERS
97
 
   res_ptr     r3
98
 
   s1_ptr      r4
99
 
   size                r5
100
 
   cnt         r6  */
101
 
 
102
 
ENTRY(mpihelp_rshift)
103
 
       mtctr   5               # copy size into CTR
104
 
       addi    7,3,-4          # move adjusted res_ptr to free return reg
105
 
       subfic  8,6,32
106
 
       lwz     11,0(4)         # load first s1 limb
107
 
       slw     3,11,8          # compute function return value
108
 
       bdz     1f
109
 
 
110
 
0:     lwzu    10,4(4)
111
 
       srw     9,11,6
112
 
       slw     12,10,8
113
 
       or      9,9,12
114
 
       stwu    9,4(7)
115
 
       bdz     2f
116
 
       lwzu    11,4(4)
117
 
       srw     9,10,6
118
 
       slw     12,11,8
119
 
       or      9,9,12
120
 
       stwu    9,4(7)
121
 
       bdnz    0b
122
 
 
123
 
1:     srw     0,11,6
124
 
       stw     0,4(7)
125
 
       blr
126
 
 
127
 
2:     srw     0,10,6
128
 
       stw     0,4(7)
129
 
       blr
130
 
END(mpihelp_rshift)
131
 
#endif