Blame sysdeps/mips/rshift.S
|
Packit |
6c4009 |
/* MIPS2 __mpn_rshift --
|
|
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 |
#include <sysdep.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 |
#ifdef __PIC__
|
|
Packit |
6c4009 |
.option pic2
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
ENTRY (__mpn_rshift)
|
|
Packit |
6c4009 |
.set noreorder
|
|
Packit |
6c4009 |
#ifdef __PIC__
|
|
Packit |
6c4009 |
.cpload t9
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
.set nomacro
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
lw $10,0($5) /* load first limb */
|
|
Packit |
6c4009 |
subu $13,$0,$7
|
|
Packit |
6c4009 |
addiu $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 |
sll $2,$10,$13 /* compute function result */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
subu $6,$6,$9
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(Loop0): lw $3,4($5)
|
|
Packit |
6c4009 |
addiu $4,$4,4
|
|
Packit |
6c4009 |
addiu $5,$5,4
|
|
Packit |
6c4009 |
addiu $9,$9,-1
|
|
Packit |
6c4009 |
srl $11,$10,$7
|
|
Packit |
6c4009 |
sll $12,$3,$13
|
|
Packit |
6c4009 |
move $10,$3
|
|
Packit |
6c4009 |
or $8,$11,$12
|
|
Packit |
6c4009 |
bne $9,$0,L(Loop0)
|
|
Packit |
6c4009 |
sw $8,-4($4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(L0): beq $6,$0,L(Lend)
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(Loop): lw $3,4($5)
|
|
Packit |
6c4009 |
addiu $4,$4,16
|
|
Packit |
6c4009 |
addiu $6,$6,-4
|
|
Packit |
6c4009 |
srl $11,$10,$7
|
|
Packit |
6c4009 |
sll $12,$3,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
lw $10,8($5)
|
|
Packit |
6c4009 |
srl $14,$3,$7
|
|
Packit |
6c4009 |
or $8,$11,$12
|
|
Packit |
6c4009 |
sw $8,-16($4)
|
|
Packit |
6c4009 |
sll $9,$10,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
lw $3,12($5)
|
|
Packit |
6c4009 |
srl $11,$10,$7
|
|
Packit |
6c4009 |
or $8,$14,$9
|
|
Packit |
6c4009 |
sw $8,-12($4)
|
|
Packit |
6c4009 |
sll $12,$3,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
lw $10,16($5)
|
|
Packit |
6c4009 |
srl $14,$3,$7
|
|
Packit |
6c4009 |
or $8,$11,$12
|
|
Packit |
6c4009 |
sw $8,-8($4)
|
|
Packit |
6c4009 |
sll $9,$10,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
addiu $5,$5,16
|
|
Packit |
6c4009 |
or $8,$14,$9
|
|
Packit |
6c4009 |
bgtz $6,L(Loop)
|
|
Packit |
6c4009 |
sw $8,-4($4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(Lend): srl $8,$10,$7
|
|
Packit |
6c4009 |
j $31
|
|
Packit |
6c4009 |
sw $8,0($4)
|
|
Packit |
6c4009 |
END (__mpn_rshift)
|