Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / alpha / div.S
blob65573e6676638631043d76f800e3197656bf92f2
1 /* Copyright (C) 1996-2014 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Richard Henderson <rth@tamu.edu>.
5    The GNU C Library is free software; you can redistribute it and/or
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.
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
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <http://www.gnu.org/licenses/>.  */
19 #include "div_libc.h"
21 #undef FRAME
22 #ifdef __alpha_fix__
23 #define FRAME 0
24 #else
25 #define FRAME 16
26 #endif
28         .set noat
30         .align 4
31         .globl div
32         .ent div
33 div:
34         .frame sp, FRAME, ra
35 #if FRAME > 0
36         lda     sp, -FRAME(sp)
37 #endif
38 #ifdef PROF
39         .set    macro
40         ldgp    gp, 0(pv)
41         lda     AT, _mcount
42         jsr     AT, (AT), _mcount
43         .set    nomacro
44         .prologue 1
45 #else
46         .prologue 0
47 #endif
49         beq     $18, $divbyzero
50         excb
51         mf_fpcr $f10
53         _ITOFT2 $17, $f0, 0, $18, $f1, 8
55         cvtqt   $f0, $f0
56         cvtqt   $f1, $f1
57         divt/c  $f0, $f1, $f0
58         cvttq/c $f0, $f0
59         excb
60         mt_fpcr $f10
61         _FTOIT  $f0, $0, 0
63         mull    $0, $18, $1
64         subl    $17, $1, $1
66         stl     $0, 0(a0)
67         stl     $1, 4(a0)
68         mov     a0, v0
70 #if FRAME > 0
71         lda     sp, FRAME(sp)
72 #endif
73         ret
75 $divbyzero:
76         mov     a0, v0
77         lda     a0, GEN_INTDIV
78         call_pal PAL_gentrap
79         stl     zero, 0(v0)
80         stl     zero, 4(v0)
82 #if FRAME > 0
83         lda     sp, FRAME(sp)
84 #endif
85         ret
87         .end div