Blame sysdeps/mips/mips64/rshift.S
|
Packit |
6c4009 |
/* MIPS3 __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 |
|
|
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_rshift)
|
|
Packit |
6c4009 |
#ifdef __PIC__
|
|
Packit |
6c4009 |
SETUP_GP /* ??? unused */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
.set noreorder
|
|
Packit |
6c4009 |
.set nomacro
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld $10,0($5) # load first limb
|
|
Packit |
6c4009 |
dsubu $13,$0,$7
|
|
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 |
dsll $2,$10,$13 # compute function result
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
dsubu $6,$6,$9
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(Loop0): ld $3,8($5)
|
|
Packit |
6c4009 |
daddiu $4,$4,8
|
|
Packit |
6c4009 |
daddiu $5,$5,8
|
|
Packit |
6c4009 |
daddiu $9,$9,-1
|
|
Packit |
6c4009 |
dsrl $11,$10,$7
|
|
Packit |
6c4009 |
dsll $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,-8($4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(L0): beq $6,$0,L(Lend)
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(Loop): ld $3,8($5)
|
|
Packit |
6c4009 |
daddiu $4,$4,32
|
|
Packit |
6c4009 |
daddiu $6,$6,-4
|
|
Packit |
6c4009 |
dsrl $11,$10,$7
|
|
Packit |
6c4009 |
dsll $12,$3,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld $10,16($5)
|
|
Packit |
6c4009 |
dsrl $14,$3,$7
|
|
Packit |
6c4009 |
or $8,$11,$12
|
|
Packit |
6c4009 |
sd $8,-32($4)
|
|
Packit |
6c4009 |
dsll $9,$10,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld $3,24($5)
|
|
Packit |
6c4009 |
dsrl $11,$10,$7
|
|
Packit |
6c4009 |
or $8,$14,$9
|
|
Packit |
6c4009 |
sd $8,-24($4)
|
|
Packit |
6c4009 |
dsll $12,$3,$13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld $10,32($5)
|
|
Packit |
6c4009 |
dsrl $14,$3,$7
|
|
Packit |
6c4009 |
or $8,$11,$12
|
|
Packit |
6c4009 |
sd $8,-16($4)
|
|
Packit |
6c4009 |
dsll $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,-8($4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
L(Lend): dsrl $8,$10,$7
|
|
Packit |
6c4009 |
j $31
|
|
Packit |
6c4009 |
sd $8,0($4)
|
|
Packit |
6c4009 |
END (__mpn_rshift)
|