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

« back to all changes in this revision

Viewing changes to mpi/alpha/mpih-mul3.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  submul_1 -- Multiply a limb vector with a limb and
 
2
 *                          subtract the result from a second limb vector.
 
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
 
 
23
 
 
24
/*******************
 
25
 * mpi_limb_t
 
26
 * mpihelp_submul_1( mpi_ptr_t res_ptr,      (r16   )
 
27
 *                   mpi_ptr_t s1_ptr,       (r17   )
 
28
 *                   mpi_size_t s1_size,     (r18   )
 
29
 *                   mpi_limb_t s2_limb)     (r19   )
 
30
 *
 
31
 * This code runs at 42 cycles/limb on EV4 and 18 cycles/limb on EV5.
 
32
 */
 
33
 
 
34
        .set    noreorder
 
35
        .set    noat
 
36
.text
 
37
        .align  3
 
38
        .globl  mpihelp_submul_1
 
39
        .ent    mpihelp_submul_1 2
 
40
mpihelp_submul_1:
 
41
        .frame  $30,0,$26
 
42
 
 
43
        ldq     $2,0($17)       # $2 = s1_limb
 
44
        addq    $17,8,$17       # s1_ptr++
 
45
        subq    $18,1,$18       # size--
 
46
        mulq    $2,$19,$3       # $3 = prod_low
 
47
        ldq     $5,0($16)       # $5 = *res_ptr
 
48
        umulh   $2,$19,$0       # $0 = prod_high
 
49
        beq     $18,.Lend1      # jump if size was == 1
 
50
        ldq     $2,0($17)       # $2 = s1_limb
 
51
        addq    $17,8,$17       # s1_ptr++
 
52
        subq    $18,1,$18       # size--
 
53
        subq    $5,$3,$3
 
54
        cmpult  $5,$3,$4
 
55
        stq     $3,0($16)
 
56
        addq    $16,8,$16       # res_ptr++
 
57
        beq     $18,.Lend2      # jump if size was == 2
 
58
 
 
59
        .align  3
 
60
.Loop:  mulq    $2,$19,$3       # $3 = prod_low
 
61
        ldq     $5,0($16)       # $5 = *res_ptr
 
62
        addq    $4,$0,$0        # cy_limb = cy_limb + 'cy'
 
63
        subq    $18,1,$18       # size--
 
64
        umulh   $2,$19,$4       # $4 = cy_limb
 
65
        ldq     $2,0($17)       # $2 = s1_limb
 
66
        addq    $17,8,$17       # s1_ptr++
 
67
        addq    $3,$0,$3        # $3 = cy_limb + prod_low
 
68
        cmpult  $3,$0,$0        # $0 = carry from (cy_limb + prod_low)
 
69
        subq    $5,$3,$3
 
70
        cmpult  $5,$3,$5
 
71
        stq     $3,0($16)
 
72
        addq    $16,8,$16       # res_ptr++
 
73
        addq    $5,$0,$0        # combine carries
 
74
        bne     $18,.Loop
 
75
 
 
76
.Lend2: mulq    $2,$19,$3       # $3 = prod_low
 
77
        ldq     $5,0($16)       # $5 = *res_ptr
 
78
        addq    $4,$0,$0        # cy_limb = cy_limb + 'cy'
 
79
        umulh   $2,$19,$4       # $4 = cy_limb
 
80
        addq    $3,$0,$3        # $3 = cy_limb + prod_low
 
81
        cmpult  $3,$0,$0        # $0 = carry from (cy_limb + prod_low)
 
82
        subq    $5,$3,$3
 
83
        cmpult  $5,$3,$5
 
84
        stq     $3,0($16)
 
85
        addq    $5,$0,$0        # combine carries
 
86
        addq    $4,$0,$0        # cy_limb = prod_high + cy
 
87
        ret     $31,($26),1
 
88
.Lend1: subq    $5,$3,$3
 
89
        cmpult  $5,$3,$5
 
90
        stq     $3,0($16)
 
91
        addq    $0,$5,$0
 
92
        ret     $31,($26),1
 
93
 
 
94
        .end    mpihelp_submul_1
 
95