~ubuntu-branches/ubuntu/trusty/grub2/trusty

« back to all changes in this revision

Viewing changes to grub-core/lib/libgcrypt/mpi/sparc32/udiv.S

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-01-16 15:18:04 UTC
  • mfrom: (17.6.38 experimental)
  • Revision ID: package-import@ubuntu.com-20140116151804-3foouk7fpqcq3sxx
Tags: 2.02~beta2-2
* Convert patch handling to git-dpm.
* Add bi-endian support to ELF parser (Tomohiro B Berry).
* Adjust restore_mkdevicemap.patch to mark get_kfreebsd_version as static,
  to appease "gcc -Werror=missing-prototypes".
* Cherry-pick from upstream:
  - Change grub-macbless' manual page section to 8.
* Install grub-glue-efi, grub-macbless, grub-render-label, and
  grub-syslinux2cfg.
* grub-shell: Pass -no-pad to xorriso when building floppy images.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* SPARC v7 __udiv_qrnnd division support, used from longlong.h.
 
2
 *           This is for v7 CPUs without a floating-point unit.
 
3
 *
 
4
 *      Copyright (C) 1993, 1994, 1996, 1998,
 
5
 *                    2001, 2002 Free Software Foundation, Inc.
 
6
 *       
 
7
 * This file is part of Libgcrypt.
 
8
 *
 
9
 * Libgcrypt is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU Lesser General Public License as
 
11
 * published by the Free Software Foundation; either version 2.1 of
 
12
 * the License, or (at your option) any later version.
 
13
 *
 
14
 * Libgcrypt is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU Lesser General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU Lesser General Public
 
20
 * License along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
22
 *
 
23
 * Note: This code is heavily based on the GNU MP Library.
 
24
 *       Actually it's the same code with only minor changes in the
 
25
 *       way the data is stored; this is to support the abstraction
 
26
 *       of an optional secure memory allocation which may be used
 
27
 *       to avoid revealing of sensitive data due to paging etc.
 
28
 */
 
29
 
 
30
 
 
31
! INPUT PARAMETERS
 
32
! rem_ptr       o0
 
33
! n1            o1
 
34
! n0            o2
 
35
! d             o3
 
36
 
 
37
#include "sysdep.h"
 
38
 
 
39
        .text
 
40
        .align 4
 
41
        .global C_SYMBOL_NAME(__udiv_qrnnd)
 
42
C_SYMBOL_NAME(__udiv_qrnnd):
 
43
        tst     %o3
 
44
        bneg    Largedivisor
 
45
        mov     8,%g1
 
46
 
 
47
        b       Lp1
 
48
        addxcc  %o2,%o2,%o2
 
49
 
 
50
Lplop:  bcc     Ln1
 
51
        addxcc  %o2,%o2,%o2
 
52
Lp1:    addx    %o1,%o1,%o1
 
53
        subcc   %o1,%o3,%o4
 
54
        bcc     Ln2
 
55
        addxcc  %o2,%o2,%o2
 
56
Lp2:    addx    %o1,%o1,%o1
 
57
        subcc   %o1,%o3,%o4
 
58
        bcc     Ln3
 
59
        addxcc  %o2,%o2,%o2
 
60
Lp3:    addx    %o1,%o1,%o1
 
61
        subcc   %o1,%o3,%o4
 
62
        bcc     Ln4
 
63
        addxcc  %o2,%o2,%o2
 
64
Lp4:    addx    %o1,%o1,%o1
 
65
        addcc   %g1,-1,%g1
 
66
        bne     Lplop
 
67
        subcc   %o1,%o3,%o4
 
68
        bcc     Ln5
 
69
        addxcc  %o2,%o2,%o2
 
70
Lp5:    st      %o1,[%o0]
 
71
        retl
 
72
        xnor    %g0,%o2,%o0
 
73
 
 
74
Lnlop:  bcc     Lp1
 
75
        addxcc  %o2,%o2,%o2
 
76
Ln1:    addx    %o4,%o4,%o4
 
77
        subcc   %o4,%o3,%o1
 
78
        bcc     Lp2
 
79
        addxcc  %o2,%o2,%o2
 
80
Ln2:    addx    %o4,%o4,%o4
 
81
        subcc   %o4,%o3,%o1
 
82
        bcc     Lp3
 
83
        addxcc  %o2,%o2,%o2
 
84
Ln3:    addx    %o4,%o4,%o4
 
85
        subcc   %o4,%o3,%o1
 
86
        bcc     Lp4
 
87
        addxcc  %o2,%o2,%o2
 
88
Ln4:    addx    %o4,%o4,%o4
 
89
        addcc   %g1,-1,%g1
 
90
        bne     Lnlop
 
91
        subcc   %o4,%o3,%o1
 
92
        bcc     Lp5
 
93
        addxcc  %o2,%o2,%o2
 
94
Ln5:    st      %o4,[%o0]
 
95
        retl
 
96
        xnor    %g0,%o2,%o0
 
97
 
 
98
Largedivisor:
 
99
        and     %o2,1,%o5       ! %o5 = n0 & 1
 
100
 
 
101
        srl     %o2,1,%o2
 
102
        sll     %o1,31,%g2
 
103
        or      %g2,%o2,%o2     ! %o2 = lo(n1n0 >> 1)
 
104
        srl     %o1,1,%o1       ! %o1 = hi(n1n0 >> 1)
 
105
 
 
106
        and     %o3,1,%g2
 
107
        srl     %o3,1,%g3       ! %g3 = floor(d / 2)
 
108
        add     %g3,%g2,%g3     ! %g3 = ceil(d / 2)
 
109
 
 
110
        b       LLp1
 
111
        addxcc  %o2,%o2,%o2
 
112
 
 
113
LLplop: bcc     LLn1
 
114
        addxcc  %o2,%o2,%o2
 
115
LLp1:   addx    %o1,%o1,%o1
 
116
        subcc   %o1,%g3,%o4
 
117
        bcc     LLn2
 
118
        addxcc  %o2,%o2,%o2
 
119
LLp2:   addx    %o1,%o1,%o1
 
120
        subcc   %o1,%g3,%o4
 
121
        bcc     LLn3
 
122
        addxcc  %o2,%o2,%o2
 
123
LLp3:   addx    %o1,%o1,%o1
 
124
        subcc   %o1,%g3,%o4
 
125
        bcc     LLn4
 
126
        addxcc  %o2,%o2,%o2
 
127
LLp4:   addx    %o1,%o1,%o1
 
128
        addcc   %g1,-1,%g1
 
129
        bne     LLplop
 
130
        subcc   %o1,%g3,%o4
 
131
        bcc     LLn5
 
132
        addxcc  %o2,%o2,%o2
 
133
LLp5:   add     %o1,%o1,%o1     ! << 1
 
134
        tst     %g2
 
135
        bne     Oddp
 
136
        add     %o5,%o1,%o1
 
137
        st      %o1,[%o0]
 
138
        retl
 
139
        xnor    %g0,%o2,%o0
 
140
 
 
141
LLnlop: bcc     LLp1
 
142
        addxcc  %o2,%o2,%o2
 
143
LLn1:   addx    %o4,%o4,%o4
 
144
        subcc   %o4,%g3,%o1
 
145
        bcc     LLp2
 
146
        addxcc  %o2,%o2,%o2
 
147
LLn2:   addx    %o4,%o4,%o4
 
148
        subcc   %o4,%g3,%o1
 
149
        bcc     LLp3
 
150
        addxcc  %o2,%o2,%o2
 
151
LLn3:   addx    %o4,%o4,%o4
 
152
        subcc   %o4,%g3,%o1
 
153
        bcc     LLp4
 
154
        addxcc  %o2,%o2,%o2
 
155
LLn4:   addx    %o4,%o4,%o4
 
156
        addcc   %g1,-1,%g1
 
157
        bne     LLnlop
 
158
        subcc   %o4,%g3,%o1
 
159
        bcc     LLp5
 
160
        addxcc  %o2,%o2,%o2
 
161
LLn5:   add     %o4,%o4,%o4     ! << 1
 
162
        tst     %g2
 
163
        bne     Oddn
 
164
        add     %o5,%o4,%o4
 
165
        st      %o4,[%o0]
 
166
        retl
 
167
        xnor    %g0,%o2,%o0
 
168
 
 
169
Oddp:   xnor    %g0,%o2,%o2
 
170
        ! q' in %o2. r' in %o1
 
171
        addcc   %o1,%o2,%o1
 
172
        bcc     LLp6
 
173
        addx    %o2,0,%o2
 
174
        sub     %o1,%o3,%o1
 
175
LLp6:   subcc   %o1,%o3,%g0
 
176
        bcs     LLp7
 
177
        subx    %o2,-1,%o2
 
178
        sub     %o1,%o3,%o1
 
179
LLp7:   st      %o1,[%o0]
 
180
        retl
 
181
        mov     %o2,%o0
 
182
 
 
183
Oddn:   xnor    %g0,%o2,%o2
 
184
        ! q' in %o2. r' in %o4
 
185
        addcc   %o4,%o2,%o4
 
186
        bcc     LLn6
 
187
        addx    %o2,0,%o2
 
188
        sub     %o4,%o3,%o4
 
189
LLn6:   subcc   %o4,%o3,%g0
 
190
        bcs     LLn7
 
191
        subx    %o2,-1,%o2
 
192
        sub     %o4,%o3,%o4
 
193
LLn7:   st      %o4,[%o0]
 
194
        retl
 
195
        mov     %o2,%o0