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

« back to all changes in this revision

Viewing changes to mpi/alpha/mpih-lshift.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 - left shift
 
2
 *
 
3
 *      Copyright (C) 1994, 1995, 1998, 2001 Free Software Foundation, Inc.
 
4
 *
 
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
/*******************
 
34
 * mpi_limb_t
 
35
 * mpihelp_lshift( 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_lshift
 
56
        .ent    mpihelp_lshift
 
57
mpihelp_lshift:
 
58
        .frame  $30,0,$26,0
 
59
 
 
60
        s8addq  $18,$17,$17     # make r17 point at end of s1
 
61
        ldq     $4,-8($17)      # load first limb
 
62
        subq    $17,8,$17
 
63
        subq    $31,$19,$7
 
64
        s8addq  $18,$16,$16     # make r16 point at end of RES
 
65
        subq    $18,1,$18
 
66
        and     $18,4-1,$20     # number of limbs in first loop
 
67
        srl     $4,$7,$0        # compute function result
 
68
 
 
69
        beq     $20,.L0
 
70
        subq    $18,$20,$18
 
71
 
 
72
        .align  3
 
73
.Loop0:
 
74
        ldq     $3,-8($17)
 
75
        subq    $16,8,$16
 
76
        subq    $17,8,$17
 
77
        subq    $20,1,$20
 
78
        sll     $4,$19,$5
 
79
        srl     $3,$7,$6
 
80
        bis     $3,$3,$4
 
81
        bis     $5,$6,$8
 
82
        stq     $8,0($16)
 
83
        bne     $20,.Loop0
 
84
 
 
85
.L0:    beq     $18,.Lend
 
86
 
 
87
        .align  3
 
88
.Loop:  ldq     $3,-8($17)
 
89
        subq    $16,32,$16
 
90
        subq    $18,4,$18
 
91
        sll     $4,$19,$5
 
92
        srl     $3,$7,$6
 
93
 
 
94
        ldq     $4,-16($17)
 
95
        sll     $3,$19,$1
 
96
        bis     $5,$6,$8
 
97
        stq     $8,24($16)
 
98
        srl     $4,$7,$2
 
99
 
 
100
        ldq     $3,-24($17)
 
101
        sll     $4,$19,$5
 
102
        bis     $1,$2,$8
 
103
        stq     $8,16($16)
 
104
        srl     $3,$7,$6
 
105
 
 
106
        ldq     $4,-32($17)
 
107
        sll     $3,$19,$1
 
108
        bis     $5,$6,$8
 
109
        stq     $8,8($16)
 
110
        srl     $4,$7,$2
 
111
 
 
112
        subq    $17,32,$17
 
113
        bis     $1,$2,$8
 
114
        stq     $8,0($16)
 
115
 
 
116
        bgt     $18,.Loop
 
117
 
 
118
.Lend:  sll     $4,$19,$8
 
119
        stq     $8,-8($16)
 
120
        ret     $31,($26),1
 
121
        .end    mpihelp_lshift
 
122
 
 
123