Blame mpn/powerpc32/750/com.asm

Packit 5c3484
dnl  PowerPC 750 mpn_com -- mpn bitwise one's complement
Packit 5c3484
Packit 5c3484
dnl  Copyright 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
include(`../config.m4')
Packit 5c3484
Packit 5c3484
Packit 5c3484
C                cycles/limb
Packit 5c3484
C 603e:            ?
Packit 5c3484
C 604e:            3.0
Packit 5c3484
C 75x (G3):        2.0
Packit 5c3484
C 7400,7410 (G4):  2.0
Packit 5c3484
C 744x,745x (G4+): 3.0
Packit 5c3484
Packit 5c3484
C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
Packit 5c3484
C
Packit 5c3484
C This loop form is necessary for the claimed speed.
Packit 5c3484
Packit 5c3484
ASM_START()
Packit 5c3484
PROLOGUE(mpn_com)
Packit 5c3484
Packit 5c3484
	C r3	dst
Packit 5c3484
	C r4	src
Packit 5c3484
	C r5	size
Packit 5c3484
Packit 5c3484
	mtctr	r5		C size
Packit 5c3484
	lwz	r5, 0(r4)	C src low limb
Packit 5c3484
Packit 5c3484
	sub	r4, r4, r3	C src-dst
Packit 5c3484
	subi	r3, r3, 4	C dst-4
Packit 5c3484
Packit 5c3484
	addi	r4, r4, 8	C src-dst+8
Packit 5c3484
	bdz	L(one)
Packit 5c3484
Packit 5c3484
L(top):
Packit 5c3484
	C r3	&dst[i-1]
Packit 5c3484
	C r4	src-dst
Packit 5c3484
	C r5	src[i]
Packit 5c3484
	C r6	scratch
Packit 5c3484
Packit 5c3484
	not	r6, r5		C ~src[i]
Packit 5c3484
	lwzx	r5, r4,r3	C src[i+1]
Packit 5c3484
Packit 5c3484
	stwu	r6, 4(r3)	C dst[i]
Packit 5c3484
	bdnz	L(top)
Packit 5c3484
Packit 5c3484
L(one):
Packit 5c3484
	not	r6, r5
Packit 5c3484
Packit 5c3484
	stw	r6, 4(r3)	C dst[size-1]
Packit 5c3484
	blr
Packit 5c3484
Packit 5c3484
EPILOGUE()