Blame sysdeps/mips/mips64/lshift.S

Packit 6c4009
/* MIPS3 __mpn_lshift --
Packit 6c4009
 *
Packit 6c4009
 * Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit 6c4009
 *
Packit 6c4009
 * This file is part of the GNU MP Library.
Packit 6c4009
 *
Packit 6c4009
 * The GNU MP Library is free software; you can redistribute it and/or modify
Packit 6c4009
 * it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
 * the Free Software Foundation; either version 2.1 of the License, or (at your
Packit 6c4009
 * option) any later version.
Packit 6c4009
 *
Packit 6c4009
 * The GNU MP Library is distributed in the hope that it will be useful, but
Packit 6c4009
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 6c4009
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
Packit 6c4009
 * License for more details.
Packit 6c4009
 *
Packit 6c4009
 * You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
 * along with the GNU MP Library.  If not, see
Packit 6c4009
 * <http://www.gnu.org/licenses/>.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <sysdep.h>
Packit 6c4009
#include <sys/asm.h>
Packit 6c4009
Packit 6c4009
/* INPUT PARAMETERS
Packit 6c4009
 * res_ptr	$4
Packit 6c4009
 * src_ptr	$5
Packit 6c4009
 * size		$6
Packit 6c4009
 * cnt		$7
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifdef __PIC__
Packit 6c4009
	.option pic2
Packit 6c4009
#endif
Packit 6c4009
ENTRY (__mpn_lshift)
Packit 6c4009
#ifdef __PIC__
Packit 6c4009
	SETUP_GP /* ??? unused */
Packit 6c4009
#endif
Packit 6c4009
	.set	noreorder
Packit 6c4009
	.set	nomacro
Packit 6c4009
Packit 6c4009
	dsll	$2,$6,3
Packit 6c4009
	daddu	$5,$5,$2	# make r5 point at end of src
Packit 6c4009
	ld	$10,-8($5)	# load first limb
Packit 6c4009
	dsubu	$13,$0,$7
Packit 6c4009
	daddu	$4,$4,$2	# make r4 point at end of res
Packit 6c4009
	daddiu	$6,$6,-1
Packit 6c4009
	and	$9,$6,4-1	# number of limbs in first loop
Packit 6c4009
	beq	$9,$0,L(L0)	# if multiple of 4 limbs, skip first loop
Packit 6c4009
	dsrl	$2,$10,$13	# compute function result
Packit 6c4009
Packit 6c4009
	dsubu	$6,$6,$9
Packit 6c4009
Packit 6c4009
L(Loop0):	ld	$3,-16($5)
Packit 6c4009
	daddiu	$4,$4,-8
Packit 6c4009
	daddiu	$5,$5,-8
Packit 6c4009
	daddiu	$9,$9,-1
Packit 6c4009
	dsll	$11,$10,$7
Packit 6c4009
	dsrl	$12,$3,$13
Packit 6c4009
	move	$10,$3
Packit 6c4009
	or	$8,$11,$12
Packit 6c4009
	bne	$9,$0,L(Loop0)
Packit 6c4009
	sd	$8,0($4)
Packit 6c4009
Packit 6c4009
L(L0):	beq	$6,$0,L(Lend)
Packit 6c4009
	nop
Packit 6c4009
Packit 6c4009
L(Loop):	ld	$3,-16($5)
Packit 6c4009
	daddiu	$4,$4,-32
Packit 6c4009
	daddiu	$6,$6,-4
Packit 6c4009
	dsll	$11,$10,$7
Packit 6c4009
	dsrl	$12,$3,$13
Packit 6c4009
Packit 6c4009
	ld	$10,-24($5)
Packit 6c4009
	dsll	$14,$3,$7
Packit 6c4009
	or	$8,$11,$12
Packit 6c4009
	sd	$8,24($4)
Packit 6c4009
	dsrl	$9,$10,$13
Packit 6c4009
Packit 6c4009
	ld	$3,-32($5)
Packit 6c4009
	dsll	$11,$10,$7
Packit 6c4009
	or	$8,$14,$9
Packit 6c4009
	sd	$8,16($4)
Packit 6c4009
	dsrl	$12,$3,$13
Packit 6c4009
Packit 6c4009
	ld	$10,-40($5)
Packit 6c4009
	dsll	$14,$3,$7
Packit 6c4009
	or	$8,$11,$12
Packit 6c4009
	sd	$8,8($4)
Packit 6c4009
	dsrl	$9,$10,$13
Packit 6c4009
Packit 6c4009
	daddiu	$5,$5,-32
Packit 6c4009
	or	$8,$14,$9
Packit 6c4009
	bgtz	$6,L(Loop)
Packit 6c4009
	sd	$8,0($4)
Packit 6c4009
Packit 6c4009
L(Lend):	dsll	$8,$10,$7
Packit 6c4009
	j	$31
Packit 6c4009
	sd	$8,-8($4)
Packit 6c4009
END (__mpn_lshift)