~ubuntu-branches/ubuntu/karmic/gnupg2/karmic-updates

« back to all changes in this revision

Viewing changes to mpi/supersparc/udiv.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
/* SuperSPARC __udiv_qrnnd division support, used from longlong.h.
 
2
 *            This is for SuperSPARC only, to compensate for its
 
3
 *            semi-functional udiv instruction.
 
4
 *
 
5
 *      Copyright (C) 1993, 1994, 1996, 1998,
 
6
 *                    2001 Free Software Foundation, Inc.
 
7
 *       
 
8
 * This file is part of GnuPG.
 
9
 *
 
10
 * GnuPG is free software; you can redistribute it and/or modify
 
11
 * it under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation; either version 2 of the License, or
 
13
 * (at your option) any later version.
 
14
 *
 
15
 * GnuPG is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 * GNU General Public License for more details.
 
19
 *
 
20
 * You should have received a copy of the GNU General Public License
 
21
 * along with this program; if not, write to the Free Software
 
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
23
 *
 
24
 * Note: This code is heavily based on the GNU MP Library.
 
25
 *       Actually it's the same code with only minor changes in the
 
26
 *       way the data is stored; this is to support the abstraction
 
27
 *       of an optional secure memory allocation which may be used
 
28
 *       to avoid revealing of sensitive data due to paging etc.
 
29
 *       The GNU MP Library itself is published under the LGPL;
 
30
 *       however I decided to publish this code under the plain GPL.
 
31
 */
 
32
 
 
33
 
 
34
 
 
35
! INPUT PARAMETERS
 
36
! rem_ptr       i0
 
37
! n1            i1
 
38
! n0            i2
 
39
! d             i3
 
40
 
 
41
#include "sysdep.h"
 
42
#undef ret      /* Kludge for glibc */
 
43
 
 
44
        .text
 
45
        .align  8
 
46
LC0:    .double 0r4294967296
 
47
LC1:    .double 0r2147483648
 
48
 
 
49
        .align  4
 
50
        .global C_SYMBOL_NAME(__udiv_qrnnd)
 
51
C_SYMBOL_NAME(__udiv_qrnnd):
 
52
        !#PROLOGUE# 0
 
53
        save    %sp,-104,%sp
 
54
        !#PROLOGUE# 1
 
55
        st      %i1,[%fp-8]
 
56
        ld      [%fp-8],%f10
 
57
        sethi   %hi(LC0),%o7
 
58
        fitod   %f10,%f4
 
59
        ldd     [%o7+%lo(LC0)],%f8
 
60
        cmp     %i1,0
 
61
        bge     L248
 
62
        mov     %i0,%i5
 
63
        faddd   %f4,%f8,%f4
 
64
L248:
 
65
        st      %i2,[%fp-8]
 
66
        ld      [%fp-8],%f10
 
67
        fmuld   %f4,%f8,%f6
 
68
        cmp     %i2,0
 
69
        bge     L249
 
70
        fitod   %f10,%f2
 
71
        faddd   %f2,%f8,%f2
 
72
L249:
 
73
        st      %i3,[%fp-8]
 
74
        faddd   %f6,%f2,%f2
 
75
        ld      [%fp-8],%f10
 
76
        cmp     %i3,0
 
77
        bge     L250
 
78
        fitod   %f10,%f4
 
79
        faddd   %f4,%f8,%f4
 
80
L250:
 
81
        fdivd   %f2,%f4,%f2
 
82
        sethi   %hi(LC1),%o7
 
83
        ldd     [%o7+%lo(LC1)],%f4
 
84
        fcmped  %f2,%f4
 
85
        nop
 
86
        fbge,a  L251
 
87
        fsubd   %f2,%f4,%f2
 
88
        fdtoi   %f2,%f2
 
89
        st      %f2,[%fp-8]
 
90
        b       L252
 
91
        ld      [%fp-8],%i4
 
92
L251:
 
93
        fdtoi   %f2,%f2
 
94
        st      %f2,[%fp-8]
 
95
        ld      [%fp-8],%i4
 
96
        sethi   %hi(-2147483648),%g2
 
97
        xor     %i4,%g2,%i4
 
98
L252:
 
99
        umul    %i3,%i4,%g3
 
100
        rd      %y,%i0
 
101
        subcc   %i2,%g3,%o7
 
102
        subxcc  %i1,%i0,%g0
 
103
        be      L253
 
104
        cmp     %o7,%i3
 
105
 
 
106
        add     %i4,-1,%i0
 
107
        add     %o7,%i3,%o7
 
108
        st      %o7,[%i5]
 
109
        ret
 
110
        restore
 
111
L253:
 
112
        blu     L246
 
113
        mov     %i4,%i0
 
114
        add     %i4,1,%i0
 
115
        sub     %o7,%i3,%o7
 
116
L246:
 
117
        st      %o7,[%i5]
 
118
        ret
 
119
        restore
 
120