Blame sysdeps/alpha/divl.S

Packit Service 82fcde
/* Copyright (C) 2004-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library.  If not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include "div_libc.h"
Packit Service 82fcde
Packit Service 82fcde
/* 32-bit signed int divide.  This is not a normal C function.  Argument
Packit Service 82fcde
   registers are t10 and t11, the result goes in t12.  Only t12 and AT may
Packit Service 82fcde
   be clobbered.
Packit Service 82fcde
Packit Service 82fcde
   The FPU can handle all input values except zero.  Whee!
Packit Service 82fcde
Packit Service 82fcde
   The FPCR save/restore is due to the fact that the EV6 _will_ set FPCR_INE
Packit Service 82fcde
   for cvttq/c even without /sui being set.  It will not, however, properly
Packit Service 82fcde
   raise the exception, so we don't have to worry about FPCR_INED being clear
Packit Service 82fcde
   and so dying by SIGFPE.  */
Packit Service 82fcde
Packit Service 82fcde
#ifndef EXTEND
Packit Service 82fcde
#define EXTEND(S,D)	sextl S, D
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
	.text
Packit Service 82fcde
	.align	4
Packit Service 82fcde
	.globl	__divl
Packit Service 82fcde
	.type	__divl, @funcnoplt
Packit Service 82fcde
	.usepv	__divl, no
Packit Service 82fcde
Packit Service 82fcde
	cfi_startproc
Packit Service 82fcde
	cfi_return_column (RA)
Packit Service 82fcde
__divl:
Packit Service 82fcde
	lda	sp, -FRAME(sp)
Packit Service 82fcde
	cfi_def_cfa_offset (FRAME)
Packit Service 82fcde
	CALL_MCOUNT
Packit Service 82fcde
	stt	$f0, 0(sp)
Packit Service 82fcde
	excb
Packit Service 82fcde
	beq	Y, DIVBYZERO
Packit Service 82fcde
Packit Service 82fcde
	stt	$f1, 8(sp)
Packit Service 82fcde
	stt	$f2, 16(sp)
Packit Service 82fcde
	cfi_rel_offset ($f0, 0)
Packit Service 82fcde
	cfi_rel_offset ($f1, 8)
Packit Service 82fcde
	cfi_rel_offset ($f2, 16)
Packit Service 82fcde
	mf_fpcr	$f2
Packit Service 82fcde
Packit Service 82fcde
	EXTEND	(X, RV)
Packit Service 82fcde
	EXTEND	(Y, AT)
Packit Service 82fcde
	_ITOFT2	RV, $f0, 24, AT, $f1, 32
Packit Service 82fcde
	cvtqt	$f0, $f0
Packit Service 82fcde
	cvtqt	$f1, $f1
Packit Service 82fcde
	divt/c	$f0, $f1, $f0
Packit Service 82fcde
	cvttq/c	$f0, $f0
Packit Service 82fcde
	excb
Packit Service 82fcde
	mt_fpcr	$f2
Packit Service 82fcde
	_FTOIT	$f0, RV, 24
Packit Service 82fcde
Packit Service 82fcde
	ldt	$f0, 0(sp)
Packit Service 82fcde
	ldt	$f1, 8(sp)
Packit Service 82fcde
	ldt	$f2, 16(sp)
Packit Service 82fcde
	lda	sp, FRAME(sp)
Packit Service 82fcde
	cfi_restore ($f0)
Packit Service 82fcde
	cfi_restore ($f1)
Packit Service 82fcde
	cfi_restore ($f2)
Packit Service 82fcde
	cfi_def_cfa_offset (0)
Packit Service 82fcde
	sextl	RV, RV
Packit Service 82fcde
	ret	$31, (RA), 1
Packit Service 82fcde
Packit Service 82fcde
	cfi_endproc
Packit Service 82fcde
	.size	__divl, .-__divl
Packit Service 82fcde
Packit Service 82fcde
	DO_DIVBYZERO