Blame mpn/arm64/mul_1.asm

Packit 5c3484
dnl  ARM64 mpn_mul_1
Packit 5c3484
Packit 5c3484
dnl  Contributed to the GNU project by Torbjörn Granlund.
Packit 5c3484
Packit 5c3484
dnl  Copyright 2013 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	     cycles/limb
Packit 5c3484
C Cortex-A53	 ?
Packit 5c3484
C Cortex-A57	 ?
Packit 5c3484
Packit 5c3484
define(`rp', `x0')
Packit 5c3484
define(`up', `x1')
Packit 5c3484
define(`n',  `x2')
Packit 5c3484
define(`v0', `x3')
Packit 5c3484
Packit 5c3484
ASM_START()
Packit 5c3484
PROLOGUE(mpn_mul_1)
Packit 5c3484
	ldr	x12, [up], #8
Packit 5c3484
	and	x6, n, #3
Packit 5c3484
	and	n, n, #-4
Packit 5c3484
	cbz	x6, L(fi0)
Packit 5c3484
	cmp	x6, #2
Packit 5c3484
	b.cc	L(fi1)
Packit 5c3484
	b.eq	L(fi2)
Packit 5c3484
Packit 5c3484
L(fi3):	mul	x8, x12, v0
Packit 5c3484
	umulh	x13, x12, v0
Packit 5c3484
	cmn	xzr, xzr
Packit 5c3484
	b	L(L3)
Packit 5c3484
L(fi2):	mul	x7, x12, v0
Packit 5c3484
	umulh	x5, x12, v0
Packit 5c3484
	cmn	xzr, xzr
Packit 5c3484
	b	L(L2)
Packit 5c3484
L(fi0):	mul	x9, x12, v0
Packit 5c3484
	umulh	x5, x12, v0
Packit 5c3484
	sub	n, n, #4
Packit 5c3484
	cmn	xzr, xzr
Packit 5c3484
	b	L(L0)
Packit 5c3484
L(fi1):	mul	x10, x12, v0
Packit 5c3484
	umulh	x13, x12, v0
Packit 5c3484
	cmn	xzr, xzr
Packit 5c3484
	cbz	n, L(end)
Packit 5c3484
Packit 5c3484
L(top):	sub	n, n, #4
Packit 5c3484
	ldr	x12, [up], #8
Packit 5c3484
	mul	x6, x12, v0
Packit 5c3484
	umulh	x5, x12, v0
Packit 5c3484
	str	x10, [rp], #8
Packit 5c3484
	adcs	x9, x6, x13
Packit 5c3484
L(L0):	ldr	x12, [up], #8
Packit 5c3484
	mul	x6, x12, v0
Packit 5c3484
	umulh	x13, x12, v0
Packit 5c3484
	str	x9, [rp] ,#8
Packit 5c3484
	adcs	x8, x6, x5
Packit 5c3484
L(L3):	ldr	x12, [up], #8
Packit 5c3484
	mul	x6, x12, v0
Packit 5c3484
	umulh	x5, x12, v0
Packit 5c3484
	str	x8, [rp], #8
Packit 5c3484
	adcs	x7, x6, x13
Packit 5c3484
L(L2):	ldr	x12, [up], #8
Packit 5c3484
	mul	x6, x12, v0
Packit 5c3484
	umulh	x13, x12, v0
Packit 5c3484
	str	x7, [rp], #8
Packit 5c3484
	adcs	x10, x6, x5
Packit 5c3484
	cbnz	n, L(top)
Packit 5c3484
Packit 5c3484
L(end):	str	x10, [rp]
Packit 5c3484
	adc	x0, x13, xzr
Packit 5c3484
	ret
Packit 5c3484
EPILOGUE()