OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [alpha/] [qrnnd.asm] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
 # Alpha 21064 __udiv_qrnnd
2
 # Copyright (C) 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
3
 
4
 # This file is part of GCC.
5
 
6
 # The GNU MP Library is free software; you can redistribute it and/or modify
7
 # it under the terms of the GNU General Public License as published by
8
 # the Free Software Foundation; either version 2 of the License, or (at your
9
 # option) any later version.
10
 
11
 # In addition to the permissions in the GNU General Public License, the
12
 # Free Software Foundation gives you unlimited permission to link the
13
 # compiled version of this file with other programs, and to distribute
14
 # those programs without any restriction coming from the use of this
15
 # file.  (The General Public License restrictions do apply in other
16
 # respects; for example, they cover modification of the file, and
17
 # distribution when not linked into another program.)
18
 
19
 # This file is distributed in the hope that it will be useful, but
20
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
22
 # License for more details.
23
 
24
 # You should have received a copy of the GNU General Public License
25
 # along with GCC; see the file COPYING.  If not, write to the
26
 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27
 # MA 02110-1301, USA.
28
 
29
#ifdef __ELF__
30
.section .note.GNU-stack,""
31
#endif
32
 
33
        .set noreorder
34
        .set noat
35
 
36
        .text
37
 
38
        .globl __udiv_qrnnd
39
        .ent __udiv_qrnnd
40
__udiv_qrnnd:
41
        .frame $30,0,$26,0
42
        .prologue 0
43
 
44
#define cnt     $2
45
#define tmp     $3
46
#define rem_ptr $16
47
#define n1      $17
48
#define n0      $18
49
#define d       $19
50
#define qb      $20
51
#define AT      $at
52
 
53
        ldiq    cnt,16
54
        blt     d,$largedivisor
55
 
56
$loop1: cmplt   n0,0,tmp
57
        addq    n1,n1,n1
58
        bis     n1,tmp,n1
59
        addq    n0,n0,n0
60
        cmpule  d,n1,qb
61
        subq    n1,d,tmp
62
        cmovne  qb,tmp,n1
63
        bis     n0,qb,n0
64
        cmplt   n0,0,tmp
65
        addq    n1,n1,n1
66
        bis     n1,tmp,n1
67
        addq    n0,n0,n0
68
        cmpule  d,n1,qb
69
        subq    n1,d,tmp
70
        cmovne  qb,tmp,n1
71
        bis     n0,qb,n0
72
        cmplt   n0,0,tmp
73
        addq    n1,n1,n1
74
        bis     n1,tmp,n1
75
        addq    n0,n0,n0
76
        cmpule  d,n1,qb
77
        subq    n1,d,tmp
78
        cmovne  qb,tmp,n1
79
        bis     n0,qb,n0
80
        cmplt   n0,0,tmp
81
        addq    n1,n1,n1
82
        bis     n1,tmp,n1
83
        addq    n0,n0,n0
84
        cmpule  d,n1,qb
85
        subq    n1,d,tmp
86
        cmovne  qb,tmp,n1
87
        bis     n0,qb,n0
88
        subq    cnt,1,cnt
89
        bgt     cnt,$loop1
90
        stq     n1,0(rem_ptr)
91
        bis     $31,n0,$0
92
        ret     $31,($26),1
93
 
94
$largedivisor:
95
        and     n0,1,$4
96
 
97
        srl     n0,1,n0
98
        sll     n1,63,tmp
99
        or      tmp,n0,n0
100
        srl     n1,1,n1
101
 
102
        and     d,1,$6
103
        srl     d,1,$5
104
        addq    $5,$6,$5
105
 
106
$loop2: cmplt   n0,0,tmp
107
        addq    n1,n1,n1
108
        bis     n1,tmp,n1
109
        addq    n0,n0,n0
110
        cmpule  $5,n1,qb
111
        subq    n1,$5,tmp
112
        cmovne  qb,tmp,n1
113
        bis     n0,qb,n0
114
        cmplt   n0,0,tmp
115
        addq    n1,n1,n1
116
        bis     n1,tmp,n1
117
        addq    n0,n0,n0
118
        cmpule  $5,n1,qb
119
        subq    n1,$5,tmp
120
        cmovne  qb,tmp,n1
121
        bis     n0,qb,n0
122
        cmplt   n0,0,tmp
123
        addq    n1,n1,n1
124
        bis     n1,tmp,n1
125
        addq    n0,n0,n0
126
        cmpule  $5,n1,qb
127
        subq    n1,$5,tmp
128
        cmovne  qb,tmp,n1
129
        bis     n0,qb,n0
130
        cmplt   n0,0,tmp
131
        addq    n1,n1,n1
132
        bis     n1,tmp,n1
133
        addq    n0,n0,n0
134
        cmpule  $5,n1,qb
135
        subq    n1,$5,tmp
136
        cmovne  qb,tmp,n1
137
        bis     n0,qb,n0
138
        subq    cnt,1,cnt
139
        bgt     cnt,$loop2
140
 
141
        addq    n1,n1,n1
142
        addq    $4,n1,n1
143
        bne     $6,$Odd
144
        stq     n1,0(rem_ptr)
145
        bis     $31,n0,$0
146
        ret     $31,($26),1
147
 
148
$Odd:
149
        /* q' in n0. r' in n1 */
150
        addq    n1,n0,n1
151
 
152
        cmpult  n1,n0,tmp       # tmp := carry from addq
153
        subq    n1,d,AT
154
        addq    n0,tmp,n0
155
        cmovne  tmp,AT,n1
156
 
157
        cmpult  n1,d,tmp
158
        addq    n0,1,AT
159
        cmoveq  tmp,AT,n0
160
        subq    n1,d,AT
161
        cmoveq  tmp,AT,n1
162
 
163
        stq     n1,0(rem_ptr)
164
        bis     $31,n0,$0
165
        ret     $31,($26),1
166
 
167
        .end    __udiv_qrnnd

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.