~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to mpi/alpha/mpih-rshift.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    rshift
 
2
 *      Copyright (C) 1994, 1995, 1998, 1999,
 
3
 *                    2000, 2001 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
 * Note: This code is heavily based on the GNU MP Library.
 
22
 *       Actually it's the same code with only minor changes in the
 
23
 *       way the data is stored; this is to support the abstraction
 
24
 *       of an optional secure memory allocation which may be used
 
25
 *       to avoid revealing of sensitive data due to paging etc.
 
26
 *       The GNU MP Library itself is published under the LGPL;
 
27
 *       however I decided to publish this code under the plain GPL.
 
28
 */
 
29
 
 
30
 
 
31
 
 
32
 
 
33
/*******************
 
34
 * mpi_limb_t
 
35
 * mpihelp_rshift( mpi_ptr_t wp,        (r16)
 
36
 *                 mpi_ptr_t up,        (r17)
 
37
 *                 mpi_size_t usize,    (r18)
 
38
 *                 unsigned cnt)        (r19)
 
39
 *
 
40
 * This code runs at 4.8 cycles/limb on the 21064.  With infinite unrolling,
 
41
 * it would take 4 cycles/limb.  It should be possible to get down to 3
 
42
 * cycles/limb since both ldq and stq can be paired with the other used
 
43
 * instructions.  But there are many restrictions in the 21064 pipeline that
 
44
 * makes it hard, if not impossible, to get down to 3 cycles/limb:
 
45
 *
 
46
 * 1. ldq has a 3 cycle delay, srl and sll have a 2 cycle delay.
 
47
 * 2. Only aligned instruction pairs can be paired.
 
48
 * 3. The store buffer or silo might not be able to deal with the bandwidth.
 
49
 */
 
50
 
 
51
        .set    noreorder
 
52
        .set    noat
 
53
.text
 
54
        .align  3
 
55
        .globl  mpihelp_rshift
 
56
        .ent    mpihelp_rshift
 
57
mpihelp_rshift:
 
58
        .frame  $30,0,$26,0
 
59
 
 
60
        ldq     $4,0($17)       # load first limb
 
61
        addq    $17,8,$17
 
62
        subq    $31,$19,$7
 
63
        subq    $18,1,$18
 
64
        and     $18,4-1,$20     # number of limbs in first loop
 
65
        sll     $4,$7,$0        # compute function result
 
66
 
 
67
        beq     $20,.R0
 
68
        subq    $18,$20,$18
 
69
 
 
70
        .align  3
 
71
.Roop0:
 
72
        ldq     $3,0($17)
 
73
        addq    $16,8,$16
 
74
        addq    $17,8,$17
 
75
        subq    $20,1,$20
 
76
        srl     $4,$19,$5
 
77
        sll     $3,$7,$6
 
78
        bis     $3,$3,$4
 
79
        bis     $5,$6,$8
 
80
        stq     $8,-8($16)
 
81
        bne     $20,.Roop0
 
82
 
 
83
.R0:    beq     $18,.Rend
 
84
 
 
85
        .align  3
 
86
.Roop:  ldq     $3,0($17)
 
87
        addq    $16,32,$16
 
88
        subq    $18,4,$18
 
89
        srl     $4,$19,$5
 
90
        sll     $3,$7,$6
 
91
 
 
92
        ldq     $4,8($17)
 
93
        srl     $3,$19,$1
 
94
        bis     $5,$6,$8
 
95
        stq     $8,-32($16)
 
96
        sll     $4,$7,$2
 
97
 
 
98
        ldq     $3,16($17)
 
99
        srl     $4,$19,$5
 
100
        bis     $1,$2,$8
 
101
        stq     $8,-24($16)
 
102
        sll     $3,$7,$6
 
103
 
 
104
        ldq     $4,24($17)
 
105
        srl     $3,$19,$1
 
106
        bis     $5,$6,$8
 
107
        stq     $8,-16($16)
 
108
        sll     $4,$7,$2
 
109
 
 
110
        addq    $17,32,$17
 
111
        bis     $1,$2,$8
 
112
        stq     $8,-8($16)
 
113
 
 
114
        bgt     $18,.Roop
 
115
 
 
116
.Rend:  srl     $4,$19,$8
 
117
        stq     $8,0($16)
 
118
        ret     $31,($26),1
 
119
        .end    mpihelp_rshift
 
120