Blame mpn/pa64/umul.asm

Packit 5c3484
dnl  Copyright 1999, 2000, 2002, 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
Packit 5c3484
dnl  Optimizations:
Packit 5c3484
dnl  * Avoid skip instructions
Packit 5c3484
dnl  * Put carry-generating and carry-consuming insns consecutively
Packit 5c3484
dnl  * Don't allocate any stack, "home" positions for parameters could be used.
Packit 5c3484
Packit 5c3484
include(`../config.m4')
Packit 5c3484
Packit 5c3484
define(`p0',`%r28')
Packit 5c3484
define(`p1',`%r29')
Packit 5c3484
define(`t32',`%r19')
Packit 5c3484
define(`t0',`%r20')
Packit 5c3484
define(`t1',`%r21')
Packit 5c3484
define(`x',`%r22')
Packit 5c3484
define(`m0',`%r23')
Packit 5c3484
define(`m1',`%r24')
Packit 5c3484
Packit 5c3484
ifdef(`HAVE_ABI_2_0w',
Packit 5c3484
`	.level	2.0w
Packit 5c3484
',`	.level	2.0
Packit 5c3484
')
Packit 5c3484
PROLOGUE(mpn_umul_ppmm_r)
Packit 5c3484
	ldo		128(%r30),%r30
Packit 5c3484
ifdef(`HAVE_ABI_2_0w',
Packit 5c3484
`	std		%r26,-64(%r30)
Packit 5c3484
	std		%r25,-56(%r30)
Packit 5c3484
	copy		%r24,%r31
Packit 5c3484
',`
Packit 5c3484
	depd		%r25,31,32,%r26
Packit 5c3484
	std		%r26,-64(%r30)
Packit 5c3484
	depd		%r23,31,32,%r24
Packit 5c3484
	std		%r24,-56(%r30)
Packit 5c3484
	ldw		-180(%r30),%r31
Packit 5c3484
')
Packit 5c3484
Packit 5c3484
	fldd		-64(%r30),%fr4
Packit 5c3484
	fldd		-56(%r30),%fr5
Packit 5c3484
Packit 5c3484
	xmpyu		%fr5R,%fr4R,%fr6
Packit 5c3484
	fstd		%fr6,-128(%r30)
Packit 5c3484
	xmpyu		%fr5R,%fr4L,%fr7
Packit 5c3484
	fstd		%fr7,-120(%r30)
Packit 5c3484
	xmpyu		%fr5L,%fr4R,%fr8
Packit 5c3484
	fstd		%fr8,-112(%r30)
Packit 5c3484
	xmpyu		%fr5L,%fr4L,%fr9
Packit 5c3484
	fstd		%fr9,-104(%r30)
Packit 5c3484
Packit 5c3484
	depdi,z		1,31,1,t32		C t32 = 2^32
Packit 5c3484
Packit 5c3484
	ldd		-128(%r30),p0		C lo = low 64 bit of product
Packit 5c3484
	ldd		-120(%r30),m0		C m0 = mid0 64 bit of product
Packit 5c3484
	ldd		-112(%r30),m1		C m1 = mid1 64 bit of product
Packit 5c3484
	ldd		-104(%r30),p1		C hi = high 64 bit of product
Packit 5c3484
Packit 5c3484
	add,l,*nuv	m0,m1,x			C x = m1+m0
Packit 5c3484
	 add,l		t32,p1,p1		C propagate carry to mid of p1
Packit 5c3484
	depd,z		x,31,32,t0		C lo32(m1+m0)
Packit 5c3484
	add		t0,p0,p0
Packit 5c3484
	extrd,u		x,31,32,t1		C hi32(m1+m0)
Packit 5c3484
	add,dc		t1,p1,p1
Packit 5c3484
Packit 5c3484
	std		p0,0(%r31)		C store low half of product
Packit 5c3484
ifdef(`HAVE_ABI_2_0w',
Packit 5c3484
`	copy		p1,%r28			C return val in %r28
Packit 5c3484
',`	extrd,u		p1,31,32,%r28		C return val in %r28,%r29
Packit 5c3484
')
Packit 5c3484
	bve		(%r2)
Packit 5c3484
	ldo		-128(%r30),%r30
Packit 5c3484
EPILOGUE(mpn_umul_ppmm_r)
Packit 5c3484