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

Subversion Repositories openrisc_me

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

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

Line No. Rev Author Line
1 282 jeremybenn
 # Alpha 21064 __udiv_qrnnd
2
 # Copyright (C) 1992, 1994, 1995, 2000, 2009 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 3 of the License, or (at your
9
 # option) any later version.
10
 
11
 # This file is distributed in the hope that it will be useful, but
12
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
14
 # License for more details.
15
 
16
 # Under Section 7 of GPL version 3, you are granted additional
17
 # permissions described in the GCC Runtime Library Exception, version
18
 # 3.1, as published by the Free Software Foundation.
19
 
20
 # You should have received a copy of the GNU General Public License and
21
 # a copy of the GCC Runtime Library Exception along with this program;
22
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
 # .
24
 
25
#ifdef __ELF__
26
.section .note.GNU-stack,""
27
#endif
28
 
29
        .set noreorder
30
        .set noat
31
 
32
        .text
33
 
34
        .globl __udiv_qrnnd
35
        .ent __udiv_qrnnd
36
__udiv_qrnnd:
37
        .frame $30,0,$26,0
38
        .prologue 0
39
 
40
#define cnt     $2
41
#define tmp     $3
42
#define rem_ptr $16
43
#define n1      $17
44
#define n0      $18
45
#define d       $19
46
#define qb      $20
47
#define AT      $at
48
 
49
        ldiq    cnt,16
50
        blt     d,$largedivisor
51
 
52
$loop1: cmplt   n0,0,tmp
53
        addq    n1,n1,n1
54
        bis     n1,tmp,n1
55
        addq    n0,n0,n0
56
        cmpule  d,n1,qb
57
        subq    n1,d,tmp
58
        cmovne  qb,tmp,n1
59
        bis     n0,qb,n0
60
        cmplt   n0,0,tmp
61
        addq    n1,n1,n1
62
        bis     n1,tmp,n1
63
        addq    n0,n0,n0
64
        cmpule  d,n1,qb
65
        subq    n1,d,tmp
66
        cmovne  qb,tmp,n1
67
        bis     n0,qb,n0
68
        cmplt   n0,0,tmp
69
        addq    n1,n1,n1
70
        bis     n1,tmp,n1
71
        addq    n0,n0,n0
72
        cmpule  d,n1,qb
73
        subq    n1,d,tmp
74
        cmovne  qb,tmp,n1
75
        bis     n0,qb,n0
76
        cmplt   n0,0,tmp
77
        addq    n1,n1,n1
78
        bis     n1,tmp,n1
79
        addq    n0,n0,n0
80
        cmpule  d,n1,qb
81
        subq    n1,d,tmp
82
        cmovne  qb,tmp,n1
83
        bis     n0,qb,n0
84
        subq    cnt,1,cnt
85
        bgt     cnt,$loop1
86
        stq     n1,0(rem_ptr)
87
        bis     $31,n0,$0
88
        ret     $31,($26),1
89
 
90
$largedivisor:
91
        and     n0,1,$4
92
 
93
        srl     n0,1,n0
94
        sll     n1,63,tmp
95
        or      tmp,n0,n0
96
        srl     n1,1,n1
97
 
98
        and     d,1,$6
99
        srl     d,1,$5
100
        addq    $5,$6,$5
101
 
102
$loop2: cmplt   n0,0,tmp
103
        addq    n1,n1,n1
104
        bis     n1,tmp,n1
105
        addq    n0,n0,n0
106
        cmpule  $5,n1,qb
107
        subq    n1,$5,tmp
108
        cmovne  qb,tmp,n1
109
        bis     n0,qb,n0
110
        cmplt   n0,0,tmp
111
        addq    n1,n1,n1
112
        bis     n1,tmp,n1
113
        addq    n0,n0,n0
114
        cmpule  $5,n1,qb
115
        subq    n1,$5,tmp
116
        cmovne  qb,tmp,n1
117
        bis     n0,qb,n0
118
        cmplt   n0,0,tmp
119
        addq    n1,n1,n1
120
        bis     n1,tmp,n1
121
        addq    n0,n0,n0
122
        cmpule  $5,n1,qb
123
        subq    n1,$5,tmp
124
        cmovne  qb,tmp,n1
125
        bis     n0,qb,n0
126
        cmplt   n0,0,tmp
127
        addq    n1,n1,n1
128
        bis     n1,tmp,n1
129
        addq    n0,n0,n0
130
        cmpule  $5,n1,qb
131
        subq    n1,$5,tmp
132
        cmovne  qb,tmp,n1
133
        bis     n0,qb,n0
134
        subq    cnt,1,cnt
135
        bgt     cnt,$loop2
136
 
137
        addq    n1,n1,n1
138
        addq    $4,n1,n1
139
        bne     $6,$Odd
140
        stq     n1,0(rem_ptr)
141
        bis     $31,n0,$0
142
        ret     $31,($26),1
143
 
144
$Odd:
145
        /* q' in n0. r' in n1 */
146
        addq    n1,n0,n1
147
 
148
        cmpult  n1,n0,tmp       # tmp := carry from addq
149
        subq    n1,d,AT
150
        addq    n0,tmp,n0
151
        cmovne  tmp,AT,n1
152
 
153
        cmpult  n1,d,tmp
154
        addq    n0,1,AT
155
        cmoveq  tmp,AT,n0
156
        subq    n1,d,AT
157
        cmoveq  tmp,AT,n1
158
 
159
        stq     n1,0(rem_ptr)
160
        bis     $31,n0,$0
161
        ret     $31,($26),1
162
 
163
        .end    __udiv_qrnnd

powered by: WebSVN 2.1.0

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