Blame mpn/pa32/hppa1_1/udiv.asm

Packit 5c3484
dnl  HP-PA  __udiv_qrnnd division support, used from longlong.h.
Packit 5c3484
dnl  This version runs fast on PA 7000 and later.
Packit 5c3484
Packit 5c3484
dnl  Copyright 1993, 1994, 2000, 2001, 2003 Free Software Foundation, Inc.
Packit 5c3484
Packit 5c3484
dnl  This file is part of the GNU MP Library.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
dnl  it under the terms of either:
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
dnl      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
dnl      option) any later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU General Public License as published by the Free Software
Packit 5c3484
dnl      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
dnl      later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or both in parallel, as here.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
dnl  for more details.
Packit 5c3484
dnl
Packit 5c3484
dnl  You should have received copies of the GNU General Public License and the
Packit 5c3484
dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
dnl  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
include(`../config.m4')
Packit 5c3484
Packit 5c3484
C INPUT PARAMETERS
Packit 5c3484
C rem_ptr	gr26
Packit 5c3484
C n1		gr25
Packit 5c3484
C n0		gr24
Packit 5c3484
C d		gr23
Packit 5c3484
Packit 5c3484
C This file has caused a lot of trouble, since it demands PIC reference to
Packit 5c3484
C static data, which triggers bugs in gas (at least version 2.7 through
Packit 5c3484
C 2.11.2).  When the bug is triggered, many bogus relocs are generated.  The
Packit 5c3484
C current solution is to stuff data right into the code, and refer it using
Packit 5c3484
C absolute offsets.  Fragile to be sure, but nothing else seems to work.
Packit 5c3484
Packit 5c3484
ASM_START()
Packit 5c3484
ifdef(`PIC',`',
Packit 5c3484
`	RODATA
Packit 5c3484
	INT64(0000, 0x43f00000, 0x0)	C 2^64
Packit 5c3484
')
Packit 5c3484
Packit 5c3484
PROLOGUE(mpn_udiv_qrnnd)
Packit 5c3484
C	.callinfo	frame=64,no_calls
Packit 5c3484
Packit 5c3484
	ldo		64(%r30),%r30
Packit 5c3484
Packit 5c3484
	stws		%r25,-16(0,%r30)	C n_hi
Packit 5c3484
	stws		%r24,-12(0,%r30)	C n_lo
Packit 5c3484
Packit 5c3484
ifdef(`PIC',
Packit 5c3484
`	bl		.+20,%r31
Packit 5c3484
	dep		%r0,31,2,%r31
Packit 5c3484
	.word	0x0				C padding for alignment
Packit 5c3484
	.word	0x43f00000, 0x0			C 2^64
Packit 5c3484
	ldo		4(%r31),%r31',
Packit 5c3484
`	ldil		`L'%L(0000),%r31
Packit 5c3484
	ldo		R%L(0000)(%r31),%r31')
Packit 5c3484
Packit 5c3484
	fldds		-16(0,%r30),%fr5
Packit 5c3484
	stws		%r23,-12(0,%r30)
Packit 5c3484
	comib,<=	0,%r25,L(1)
Packit 5c3484
	fcnvxf,dbl,dbl	%fr5,%fr5
Packit 5c3484
	fldds		0(0,%r31),%fr4
Packit 5c3484
	fadd,dbl	%fr4,%fr5,%fr5
Packit 5c3484
Packit 5c3484
LDEF(1)
Packit 5c3484
	fcpy,sgl	%fr0,%fr6L
Packit 5c3484
	fldws		-12(0,%r30),%fr6R
Packit 5c3484
	fcnvxf,dbl,dbl	%fr6,%fr4
Packit 5c3484
Packit 5c3484
	fdiv,dbl	%fr5,%fr4,%fr5
Packit 5c3484
Packit 5c3484
	fcnvfx,dbl,dbl	%fr5,%fr4
Packit 5c3484
	fstws		%fr4R,-16(%r30)
Packit 5c3484
	xmpyu		%fr4R,%fr6R,%fr6
Packit 5c3484
	ldws		-16(%r30),%r28
Packit 5c3484
	fstds		%fr6,-16(0,%r30)
Packit 5c3484
	ldws		-12(0,%r30),%r21
Packit 5c3484
	ldws		-16(0,%r30),%r20
Packit 5c3484
	sub		%r24,%r21,%r22
Packit 5c3484
	subb		%r25,%r20,%r20
Packit 5c3484
	comib,=		0,%r20,L(2)
Packit 5c3484
	ldo		-64(%r30),%r30
Packit 5c3484
Packit 5c3484
	add		%r22,%r23,%r22
Packit 5c3484
	ldo		-1(%r28),%r28
Packit 5c3484
Packit 5c3484
LDEF(2)
Packit 5c3484
	bv		0(%r2)
Packit 5c3484
	stws		%r22,0(0,%r26)
Packit 5c3484
Packit 5c3484
EPILOGUE(mpn_udiv_qrnnd)