Blame mpn/mips32/rshift.asm

Packit 5c3484
dnl  MIPS32 mpn_rshift -- Right shift.
Packit 5c3484
Packit 5c3484
dnl  Copyright 1995, 2000, 2002 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 res_ptr	$4
Packit 5c3484
C src_ptr	$5
Packit 5c3484
C size		$6
Packit 5c3484
C cnt		$7
Packit 5c3484
Packit 5c3484
ASM_START()
Packit 5c3484
PROLOGUE(mpn_rshift)
Packit 5c3484
	lw	$10,0($5)	C load first limb
Packit 5c3484
	subu	$13,$0,$7
Packit 5c3484
	addiu	$6,$6,-1
Packit 5c3484
	and	$9,$6,4-1	C number of limbs in first loop
Packit 5c3484
	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
Packit 5c3484
	 sll	$2,$10,$13	C compute function result
Packit 5c3484
Packit 5c3484
	subu	$6,$6,$9
Packit 5c3484
Packit 5c3484
.Loop0:	lw	$3,4($5)
Packit 5c3484
	addiu	$4,$4,4
Packit 5c3484
	addiu	$5,$5,4
Packit 5c3484
	addiu	$9,$9,-1
Packit 5c3484
	srl	$11,$10,$7
Packit 5c3484
	sll	$12,$3,$13
Packit 5c3484
	move	$10,$3
Packit 5c3484
	or	$8,$11,$12
Packit 5c3484
	bne	$9,$0,.Loop0
Packit 5c3484
	 sw	$8,-4($4)
Packit 5c3484
Packit 5c3484
.L0:	beq	$6,$0,.Lend
Packit 5c3484
	 nop
Packit 5c3484
Packit 5c3484
.Loop:	lw	$3,4($5)
Packit 5c3484
	addiu	$4,$4,16
Packit 5c3484
	addiu	$6,$6,-4
Packit 5c3484
	srl	$11,$10,$7
Packit 5c3484
	sll	$12,$3,$13
Packit 5c3484
Packit 5c3484
	lw	$10,8($5)
Packit 5c3484
	srl	$14,$3,$7
Packit 5c3484
	or	$8,$11,$12
Packit 5c3484
	sw	$8,-16($4)
Packit 5c3484
	sll	$9,$10,$13
Packit 5c3484
Packit 5c3484
	lw	$3,12($5)
Packit 5c3484
	srl	$11,$10,$7
Packit 5c3484
	or	$8,$14,$9
Packit 5c3484
	sw	$8,-12($4)
Packit 5c3484
	sll	$12,$3,$13
Packit 5c3484
Packit 5c3484
	lw	$10,16($5)
Packit 5c3484
	srl	$14,$3,$7
Packit 5c3484
	or	$8,$11,$12
Packit 5c3484
	sw	$8,-8($4)
Packit 5c3484
	sll	$9,$10,$13
Packit 5c3484
Packit 5c3484
	addiu	$5,$5,16
Packit 5c3484
	or	$8,$14,$9
Packit 5c3484
	bgtz	$6,.Loop
Packit 5c3484
	 sw	$8,-4($4)
Packit 5c3484
Packit 5c3484
.Lend:	srl	$8,$10,$7
Packit 5c3484
	j	$31
Packit 5c3484
	sw	$8,0($4)
Packit 5c3484
EPILOGUE(mpn_rshift)