~ubuntu-branches/ubuntu/jaunty/gnupg2/jaunty-security

« back to all changes in this revision

Viewing changes to mpi/power/mpih-mul2.S

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* IBM POWER addmul_1 -- Multiply a limb vector with a limb and add
2
 
 *                       the result to a second limb vector.
3
 
 *
4
 
 *      Copyright (C) 1992, 1994, 1999 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
 
#include "sysdep.h"
24
 
#include "asm-syntax.h"
25
 
 
26
 
 
27
 
 
28
 
/*
29
 
# INPUT PARAMETERS
30
 
# res_ptr       r3
31
 
# s1_ptr        r4
32
 
# size          r5
33
 
# s2_limb       r6
34
 
 
35
 
# The RS/6000 has no unsigned 32x32->64 bit multiplication instruction.  To
36
 
# obtain that operation, we have to use the 32x32->64 signed multiplication
37
 
# instruction, and add the appropriate compensation to the high limb of the
38
 
# result.  We add the multiplicand if the multiplier has its most significant
39
 
# bit set, and we add the multiplier if the multiplicand has its most
40
 
# significant bit set.  We need to preserve the carry flag between each
41
 
# iteration, so we have to compute the compensation carefully (the natural,
42
 
# srai+and doesn't work).  Since the POWER architecture has a branch unit
43
 
# we can branch in zero cycles, so that's how we perform the additions.
44
 
 */
45
 
 
46
 
        .toc
47
 
        .csect .mpihelp_addmul_1[PR]
48
 
        .align 2
49
 
        .globl mpihelp_addmul_1
50
 
        .globl .mpihelp_addmul_1
51
 
        .csect mpihelp_addmul_1[DS]
52
 
mpihelp_addmul_1:
53
 
        .long .mpihelp_addmul_1[PR], TOC[tc0], 0
54
 
        .csect .mpihelp_addmul_1[PR]
55
 
.mpihelp_addmul_1:
56
 
 
57
 
        cal     3,-4(3)
58
 
        l       0,0(4)
59
 
        cmpi    0,6,0
60
 
        mtctr   5
61
 
        mul     9,0,6
62
 
        srai    7,0,31
63
 
        and     7,7,6
64
 
        mfmq    8
65
 
        cax     9,9,7
66
 
        l       7,4(3)
67
 
        a       8,8,7           # add res_limb
68
 
        blt     Lneg
69
 
Lpos:   bdz     Lend
70
 
 
71
 
Lploop: lu      0,4(4)
72
 
        stu     8,4(3)
73
 
        cmpi    0,0,0
74
 
        mul     10,0,6
75
 
        mfmq    0
76
 
        ae      8,0,9           # low limb + old_cy_limb + old cy
77
 
        l       7,4(3)
78
 
        aze     10,10           # propagate cy to new cy_limb
79
 
        a       8,8,7           # add res_limb
80
 
        bge     Lp0
81
 
        cax     10,10,6         # adjust high limb for negative limb from s1
82
 
Lp0:    bdz     Lend0
83
 
        lu      0,4(4)
84
 
        stu     8,4(3)
85
 
        cmpi    0,0,0
86
 
        mul     9,0,6
87
 
        mfmq    0
88
 
        ae      8,0,10
89
 
        l       7,4(3)
90
 
        aze     9,9
91
 
        a       8,8,7
92
 
        bge     Lp1
93
 
        cax     9,9,6           # adjust high limb for negative limb from s1
94
 
Lp1:    bdn     Lploop
95
 
 
96
 
        b       Lend
97
 
 
98
 
Lneg:   cax     9,9,0
99
 
        bdz     Lend
100
 
Lnloop: lu      0,4(4)
101
 
        stu     8,4(3)
102
 
        cmpi    0,0,0
103
 
        mul     10,0,6
104
 
        mfmq    7
105
 
        ae      8,7,9
106
 
        l       7,4(3)
107
 
        ae      10,10,0         # propagate cy to new cy_limb
108
 
        a       8,8,7           # add res_limb
109
 
        bge     Ln0
110
 
        cax     10,10,6         # adjust high limb for negative limb from s1
111
 
Ln0:    bdz     Lend0
112
 
        lu      0,4(4)
113
 
        stu     8,4(3)
114
 
        cmpi    0,0,0
115
 
        mul     9,0,6
116
 
        mfmq    7
117
 
        ae      8,7,10
118
 
        l       7,4(3)
119
 
        ae      9,9,0           # propagate cy to new cy_limb
120
 
        a       8,8,7           # add res_limb
121
 
        bge     Ln1
122
 
        cax     9,9,6           # adjust high limb for negative limb from s1
123
 
Ln1:    bdn     Lnloop
124
 
        b       Lend
125
 
 
126
 
Lend0:  cal     9,0(10)
127
 
Lend:   st      8,4(3)
128
 
        aze     3,9
129
 
        br
130