Blame sysdeps/alpha/div.S
|
Packit |
6c4009 |
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
Contributed by Richard Henderson <rth@tamu.edu>.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library. If not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include "div_libc.h"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef FRAME
|
|
Packit |
6c4009 |
#ifdef __alpha_fix__
|
|
Packit |
6c4009 |
#define FRAME 0
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
#define FRAME 16
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.set noat
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align 4
|
|
Packit |
6c4009 |
.globl div
|
|
Packit |
6c4009 |
.ent div
|
|
Packit |
6c4009 |
div:
|
|
Packit |
6c4009 |
.frame sp, FRAME, ra
|
|
Packit |
6c4009 |
#if FRAME > 0
|
|
Packit |
6c4009 |
lda sp, -FRAME(sp)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#ifdef PROF
|
|
Packit |
6c4009 |
.set macro
|
|
Packit |
6c4009 |
ldgp gp, 0(pv)
|
|
Packit |
6c4009 |
lda AT, _mcount
|
|
Packit |
6c4009 |
jsr AT, (AT), _mcount
|
|
Packit |
6c4009 |
.set nomacro
|
|
Packit |
6c4009 |
.prologue 1
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
.prologue 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
beq $18, $divbyzero
|
|
Packit |
6c4009 |
excb
|
|
Packit |
6c4009 |
mf_fpcr $f10
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
_ITOFT2 $17, $f0, 0, $18, $f1, 8
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cvtqt $f0, $f0
|
|
Packit |
6c4009 |
cvtqt $f1, $f1
|
|
Packit |
6c4009 |
divt/c $f0, $f1, $f0
|
|
Packit |
6c4009 |
cvttq/c $f0, $f0
|
|
Packit |
6c4009 |
excb
|
|
Packit |
6c4009 |
mt_fpcr $f10
|
|
Packit |
6c4009 |
_FTOIT $f0, $0, 0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mull $0, $18, $1
|
|
Packit |
6c4009 |
subl $17, $1, $1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
stl $0, 0(a0)
|
|
Packit |
6c4009 |
stl $1, 4(a0)
|
|
Packit |
6c4009 |
mov a0, v0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if FRAME > 0
|
|
Packit |
6c4009 |
lda sp, FRAME(sp)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
$divbyzero:
|
|
Packit |
6c4009 |
mov a0, v0
|
|
Packit |
6c4009 |
lda a0, GEN_INTDIV
|
|
Packit |
6c4009 |
call_pal PAL_gentrap
|
|
Packit |
6c4009 |
stl zero, 0(v0)
|
|
Packit |
6c4009 |
stl zero, 4(v0)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if FRAME > 0
|
|
Packit |
6c4009 |
lda sp, FRAME(sp)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.end div
|