]>
Commit | Line | Data |
---|---|---|
b168057a | 1 | /* Copyright (C) 1996-2015 Free Software Foundation, Inc. |
60c74cf0 | 2 | This file is part of the GNU C Library. |
cb23ff1f | 3 | Contributed by Richard Henderson <rth@tamu.edu>. |
60c74cf0 UD |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or | |
3214b89b AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
60c74cf0 UD |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
3214b89b | 13 | Lesser General Public License for more details. |
60c74cf0 | 14 | |
3214b89b | 15 | You should have received a copy of the GNU Lesser General Public |
ab84e3ff PE |
16 | License along with the GNU C Library. If not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
60c74cf0 | 18 | |
bd68d850 | 19 | #include "div_libc.h" |
60c74cf0 | 20 | |
bd68d850 RH |
21 | #undef FRAME |
22 | #ifdef __alpha_fix__ | |
23 | #define FRAME 0 | |
60c74cf0 | 24 | #else |
bd68d850 | 25 | #define FRAME 16 |
60c74cf0 UD |
26 | #endif |
27 | ||
28 | .set noat | |
29 | ||
30 | .align 4 | |
31 | .globl div | |
32 | .ent div | |
33 | div: | |
bd68d850 RH |
34 | .frame sp, FRAME, ra |
35 | #if FRAME > 0 | |
36 | lda sp, -FRAME(sp) | |
37 | #endif | |
60c74cf0 | 38 | #ifdef PROF |
bd68d850 | 39 | .set macro |
60c74cf0 UD |
40 | ldgp gp, 0(pv) |
41 | lda AT, _mcount | |
42 | jsr AT, (AT), _mcount | |
bd68d850 | 43 | .set nomacro |
60c74cf0 UD |
44 | .prologue 1 |
45 | #else | |
46 | .prologue 0 | |
47 | #endif | |
48 | ||
bd68d850 | 49 | beq $18, $divbyzero |
a61c91b0 RH |
50 | excb |
51 | mf_fpcr $f10 | |
bd68d850 RH |
52 | |
53 | _ITOFT2 $17, $f0, 0, $18, $f1, 8 | |
54 | ||
55 | cvtqt $f0, $f0 | |
56 | cvtqt $f1, $f1 | |
57 | divt/c $f0, $f1, $f0 | |
58 | cvttq/c $f0, $f0 | |
a61c91b0 RH |
59 | excb |
60 | mt_fpcr $f10 | |
bd68d850 RH |
61 | _FTOIT $f0, $0, 0 |
62 | ||
63 | mull $0, $18, $1 | |
64 | subl $17, $1, $1 | |
65 | ||
66 | stl $0, 0(a0) | |
67 | stl $1, 4(a0) | |
68 | mov a0, v0 | |
69 | ||
70 | #if FRAME > 0 | |
71 | lda sp, FRAME(sp) | |
72 | #endif | |
73 | ret | |
60c74cf0 UD |
74 | |
75 | $divbyzero: | |
76 | mov a0, v0 | |
bd68d850 | 77 | lda a0, GEN_INTDIV |
60c74cf0 | 78 | call_pal PAL_gentrap |
60c74cf0 UD |
79 | stl zero, 0(v0) |
80 | stl zero, 4(v0) | |
bd68d850 RH |
81 | |
82 | #if FRAME > 0 | |
83 | lda sp, FRAME(sp) | |
84 | #endif | |
60c74cf0 UD |
85 | ret |
86 | ||
87 | .end div |