~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to mpi/alpha/udiv-qrnnd.S

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2006-01-24 04:31:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060124043142-pbg192or6qxv3yk2
Tags: 1.9.20-1
* New Upstream version. Closes:#306890,#344530
  * Closes:#320490: gpg-protect-tool fails to decrypt PKCS-12 files 
* Depend on libopensc2-dev, not -1-. Closes:#348106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Alpha 21064 __udiv_qrnnd
 
2
 *
 
3
 *      Copyright (C) 1992, 1994, 1995, 1998,
 
4
 *                    2001 Free Software Foundation, Inc.
 
5
 *
 
6
 * This file is part of GnuPG.
 
7
 *
 
8
 * GnuPG is free software; you can redistribute it and/or modify
 
9
 * it under the terms of the GNU General Public License as published by
 
10
 * the Free Software Foundation; either version 2 of the License, or
 
11
 * (at your option) any later version.
 
12
 *
 
13
 * GnuPG 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 General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with this program; if not, write to the Free Software
 
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
21
 *
 
22
 * Note: This code is heavily based on the GNU MP Library.
 
23
 *       Actually it's the same code with only minor changes in the
 
24
 *       way the data is stored; this is to support the abstraction
 
25
 *       of an optional secure memory allocation which may be used
 
26
 *       to avoid revealing of sensitive data due to paging etc.
 
27
 *       The GNU MP Library itself is published under the LGPL;
 
28
 *       however I decided to publish this code under the plain GPL.
 
29
 */
 
30
 
 
31
 
 
32
 
 
33
        .set noreorder
 
34
        .set noat
 
35
.text
 
36
        .align  3
 
37
        .globl  __udiv_qrnnd
 
38
        .ent    __udiv_qrnnd
 
39
__udiv_qrnnd:
 
40
        .frame $30,0,$26,0
 
41
        .prologue 0
 
42
#define cnt     $2
 
43
#define tmp     $3
 
44
#define rem_ptr $16
 
45
#define n1      $17
 
46
#define n0      $18
 
47
#define d       $19
 
48
#define qb      $20
 
49
 
 
50
        ldiq    cnt,16
 
51
        blt     d,.Largedivisor
 
52
 
 
53
.Loop1: cmplt   n0,0,tmp
 
54
        addq    n1,n1,n1
 
55
        bis     n1,tmp,n1
 
56
        addq    n0,n0,n0
 
57
        cmpule  d,n1,qb
 
58
        subq    n1,d,tmp
 
59
        cmovne  qb,tmp,n1
 
60
        bis     n0,qb,n0
 
61
        cmplt   n0,0,tmp
 
62
        addq    n1,n1,n1
 
63
        bis     n1,tmp,n1
 
64
        addq    n0,n0,n0
 
65
        cmpule  d,n1,qb
 
66
        subq    n1,d,tmp
 
67
        cmovne  qb,tmp,n1
 
68
        bis     n0,qb,n0
 
69
        cmplt   n0,0,tmp
 
70
        addq    n1,n1,n1
 
71
        bis     n1,tmp,n1
 
72
        addq    n0,n0,n0
 
73
        cmpule  d,n1,qb
 
74
        subq    n1,d,tmp
 
75
        cmovne  qb,tmp,n1
 
76
        bis     n0,qb,n0
 
77
        cmplt   n0,0,tmp
 
78
        addq    n1,n1,n1
 
79
        bis     n1,tmp,n1
 
80
        addq    n0,n0,n0
 
81
        cmpule  d,n1,qb
 
82
        subq    n1,d,tmp
 
83
        cmovne  qb,tmp,n1
 
84
        bis     n0,qb,n0
 
85
        subq    cnt,1,cnt
 
86
        bgt     cnt,.Loop1
 
87
        stq     n1,0(rem_ptr)
 
88
        bis     $31,n0,$0
 
89
        ret     $31,($26),1
 
90
 
 
91
.Largedivisor:
 
92
        and     n0,1,$4
 
93
 
 
94
        srl     n0,1,n0
 
95
        sll     n1,63,tmp
 
96
        or      tmp,n0,n0
 
97
        srl     n1,1,n1
 
98
 
 
99
        and     d,1,$6
 
100
        srl     d,1,$5
 
101
        addq    $5,$6,$5
 
102
 
 
103
.Loop2: cmplt   n0,0,tmp
 
104
        addq    n1,n1,n1
 
105
        bis     n1,tmp,n1
 
106
        addq    n0,n0,n0
 
107
        cmpule  $5,n1,qb
 
108
        subq    n1,$5,tmp
 
109
        cmovne  qb,tmp,n1
 
110
        bis     n0,qb,n0
 
111
        cmplt   n0,0,tmp
 
112
        addq    n1,n1,n1
 
113
        bis     n1,tmp,n1
 
114
        addq    n0,n0,n0
 
115
        cmpule  $5,n1,qb
 
116
        subq    n1,$5,tmp
 
117
        cmovne  qb,tmp,n1
 
118
        bis     n0,qb,n0
 
119
        cmplt   n0,0,tmp
 
120
        addq    n1,n1,n1
 
121
        bis     n1,tmp,n1
 
122
        addq    n0,n0,n0
 
123
        cmpule  $5,n1,qb
 
124
        subq    n1,$5,tmp
 
125
        cmovne  qb,tmp,n1
 
126
        bis     n0,qb,n0
 
127
        cmplt   n0,0,tmp
 
128
        addq    n1,n1,n1
 
129
        bis     n1,tmp,n1
 
130
        addq    n0,n0,n0
 
131
        cmpule  $5,n1,qb
 
132
        subq    n1,$5,tmp
 
133
        cmovne  qb,tmp,n1
 
134
        bis     n0,qb,n0
 
135
        subq    cnt,1,cnt
 
136
        bgt     cnt,.Loop2
 
137
 
 
138
        addq    n1,n1,n1
 
139
        addq    $4,n1,n1
 
140
        bne     $6,.LOdd
 
141
        stq     n1,0(rem_ptr)
 
142
        bis     $31,n0,$0
 
143
        ret     $31,($26),1
 
144
 
 
145
.LOdd:
 
146
        /* q' in n0. r' in n1 */
 
147
        addq    n1,n0,n1
 
148
        cmpult  n1,n0,tmp       # tmp := carry from addq
 
149
        beq     tmp,.LLp6
 
150
        addq    n0,1,n0
 
151
        subq    n1,d,n1
 
152
.LLp6:  cmpult  n1,d,tmp
 
153
        bne     tmp,.LLp7
 
154
        addq    n0,1,n0
 
155
        subq    n1,d,n1
 
156
.LLp7:
 
157
        stq     n1,0(rem_ptr)
 
158
        bis     $31,n0,$0
 
159
        ret     $31,($26),1
 
160
 
 
161
        .end    __udiv_qrnnd