~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gmp/mpn/sparc32/udiv_fp.asm

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2007-04-09 11:51:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070409115151-ql8cr0kalzx1jmla
Tags: 0.9i-20070324-2
Upload to unstable. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl  SPARC v7 __udiv_qrnnd division support, used from longlong.h.
2
 
dnl  This is for v7 CPUs with a floating-point unit.
3
 
 
4
 
dnl  Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
5
 
 
6
 
dnl  This file is part of the GNU MP Library.
7
 
 
8
 
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9
 
dnl  it under the terms of the GNU Lesser General Public License as published
10
 
dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
11
 
dnl  your option) any later version.
12
 
 
13
 
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
14
 
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
 
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16
 
dnl  License for more details.
17
 
 
18
 
dnl  You should have received a copy of the GNU Lesser General Public License
19
 
dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
20
 
dnl  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21
 
dnl  MA 02111-1307, USA.
22
 
 
23
 
 
24
 
include(`../config.m4')
25
 
 
26
 
C INPUT PARAMETERS
27
 
C rem_ptr       i0
28
 
C n1            i1
29
 
C n0            i2
30
 
C d             i3
31
 
 
32
 
ASM_START()
33
 
 
34
 
ifdef(`PIC',
35
 
`       TEXT
36
 
L(getpc):
37
 
        retl
38
 
        nop')
39
 
 
40
 
        TEXT
41
 
        ALIGN(8)
42
 
L(C0):  .double 0r4294967296
43
 
L(C1):  .double 0r2147483648
44
 
 
45
 
PROLOGUE(mpn_udiv_qrnnd)
46
 
        save    %sp,-104,%sp
47
 
        st      %i1,[%fp-8]
48
 
        ld      [%fp-8],%f10
49
 
 
50
 
ifdef(`PIC',
51
 
`L(pc): call    L(getpc)                C put address of this insn in %o7
52
 
        ldd     [%o7+L(C0)-L(pc)],%f8',
53
 
`       sethi   %hi(L(C0)),%o7
54
 
        ldd     [%o7+%lo(L(C0))],%f8')
55
 
 
56
 
        fitod   %f10,%f4
57
 
        cmp     %i1,0
58
 
        bge     L(248)
59
 
        mov     %i0,%i5
60
 
        faddd   %f4,%f8,%f4
61
 
L(248):
62
 
        st      %i2,[%fp-8]
63
 
        ld      [%fp-8],%f10
64
 
        fmuld   %f4,%f8,%f6
65
 
        cmp     %i2,0
66
 
        bge     L(249)
67
 
        fitod   %f10,%f2
68
 
        faddd   %f2,%f8,%f2
69
 
L(249):
70
 
        st      %i3,[%fp-8]
71
 
        faddd   %f6,%f2,%f2
72
 
        ld      [%fp-8],%f10
73
 
        cmp     %i3,0
74
 
        bge     L(250)
75
 
        fitod   %f10,%f4
76
 
        faddd   %f4,%f8,%f4
77
 
L(250):
78
 
        fdivd   %f2,%f4,%f2
79
 
 
80
 
ifdef(`PIC',
81
 
`       ldd     [%o7+L(C1)-L(pc)],%f4',
82
 
`       sethi   %hi(L(C1)),%o7
83
 
        ldd     [%o7+%lo(L(C1))],%f4')
84
 
 
85
 
        fcmped  %f2,%f4
86
 
        nop
87
 
        fbge,a  L(251)
88
 
        fsubd   %f2,%f4,%f2
89
 
        fdtoi   %f2,%f2
90
 
        st      %f2,[%fp-8]
91
 
        b       L(252)
92
 
        ld      [%fp-8],%i4
93
 
L(251):
94
 
        fdtoi   %f2,%f2
95
 
        st      %f2,[%fp-8]
96
 
        ld      [%fp-8],%i4
97
 
        sethi   %hi(-2147483648),%g2
98
 
        xor     %i4,%g2,%i4
99
 
L(252):
100
 
        wr      %g0,%i4,%y
101
 
        sra     %i3,31,%g2
102
 
        and     %i4,%g2,%g2
103
 
        andcc   %g0,0,%g1
104
 
        mulscc  %g1,%i3,%g1
105
 
        mulscc  %g1,%i3,%g1
106
 
        mulscc  %g1,%i3,%g1
107
 
        mulscc  %g1,%i3,%g1
108
 
        mulscc  %g1,%i3,%g1
109
 
        mulscc  %g1,%i3,%g1
110
 
        mulscc  %g1,%i3,%g1
111
 
        mulscc  %g1,%i3,%g1
112
 
        mulscc  %g1,%i3,%g1
113
 
        mulscc  %g1,%i3,%g1
114
 
        mulscc  %g1,%i3,%g1
115
 
        mulscc  %g1,%i3,%g1
116
 
        mulscc  %g1,%i3,%g1
117
 
        mulscc  %g1,%i3,%g1
118
 
        mulscc  %g1,%i3,%g1
119
 
        mulscc  %g1,%i3,%g1
120
 
        mulscc  %g1,%i3,%g1
121
 
        mulscc  %g1,%i3,%g1
122
 
        mulscc  %g1,%i3,%g1
123
 
        mulscc  %g1,%i3,%g1
124
 
        mulscc  %g1,%i3,%g1
125
 
        mulscc  %g1,%i3,%g1
126
 
        mulscc  %g1,%i3,%g1
127
 
        mulscc  %g1,%i3,%g1
128
 
        mulscc  %g1,%i3,%g1
129
 
        mulscc  %g1,%i3,%g1
130
 
        mulscc  %g1,%i3,%g1
131
 
        mulscc  %g1,%i3,%g1
132
 
        mulscc  %g1,%i3,%g1
133
 
        mulscc  %g1,%i3,%g1
134
 
        mulscc  %g1,%i3,%g1
135
 
        mulscc  %g1,%i3,%g1
136
 
        mulscc  %g1,0,%g1
137
 
        add     %g1,%g2,%i0
138
 
        rd      %y,%g3
139
 
        subcc   %i2,%g3,%o7
140
 
        subxcc  %i1,%i0,%g0
141
 
        be      L(253)
142
 
        cmp     %o7,%i3
143
 
 
144
 
        add     %i4,-1,%i0
145
 
        add     %o7,%i3,%o7
146
 
        st      %o7,[%i5]
147
 
        ret
148
 
        restore
149
 
L(253):
150
 
        blu     L(246)
151
 
        mov     %i4,%i0
152
 
        add     %i4,1,%i0
153
 
        sub     %o7,%i3,%o7
154
 
L(246):
155
 
        st      %o7,[%i5]
156
 
        ret
157
 
        restore
158
 
EPILOGUE(mpn_udiv_qrnnd)