beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / mips32 / lshift.asm
blob6a58bb4579bd5d9a8828ec46c58d2b0b66c56de8
1 dnl MIPS32 mpn_lshift -- Left shift.
3 dnl Copyright 1995, 2000, 2002 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
6 dnl
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of either:
9 dnl
10 dnl * the GNU Lesser General Public License as published by the Free
11 dnl Software Foundation; either version 3 of the License, or (at your
12 dnl option) any later version.
13 dnl
14 dnl or
15 dnl
16 dnl * the GNU General Public License as published by the Free Software
17 dnl Foundation; either version 2 of the License, or (at your option) any
18 dnl later version.
19 dnl
20 dnl or both in parallel, as here.
21 dnl
22 dnl The GNU MP Library is distributed in the hope that it will be useful, but
23 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 dnl for more details.
26 dnl
27 dnl You should have received copies of the GNU General Public License and the
28 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
29 dnl see https://www.gnu.org/licenses/.
31 include(`../config.m4')
33 C INPUT PARAMETERS
34 C res_ptr $4
35 C src_ptr $5
36 C size $6
37 C cnt $7
39 ASM_START()
40 PROLOGUE(mpn_lshift)
41 sll $2,$6,2
42 addu $5,$5,$2 C make r5 point at end of src
43 lw $10,-4($5) C load first limb
44 subu $13,$0,$7
45 addu $4,$4,$2 C make r4 point at end of res
46 addiu $6,$6,-1
47 and $9,$6,4-1 C number of limbs in first loop
48 beq $9,$0,.L0 C if multiple of 4 limbs, skip first loop
49 srl $2,$10,$13 C compute function result
51 subu $6,$6,$9
53 .Loop0: lw $3,-8($5)
54 addiu $4,$4,-4
55 addiu $5,$5,-4
56 addiu $9,$9,-1
57 sll $11,$10,$7
58 srl $12,$3,$13
59 move $10,$3
60 or $8,$11,$12
61 bne $9,$0,.Loop0
62 sw $8,0($4)
64 .L0: beq $6,$0,.Lend
65 nop
67 .Loop: lw $3,-8($5)
68 addiu $4,$4,-16
69 addiu $6,$6,-4
70 sll $11,$10,$7
71 srl $12,$3,$13
73 lw $10,-12($5)
74 sll $14,$3,$7
75 or $8,$11,$12
76 sw $8,12($4)
77 srl $9,$10,$13
79 lw $3,-16($5)
80 sll $11,$10,$7
81 or $8,$14,$9
82 sw $8,8($4)
83 srl $12,$3,$13
85 lw $10,-20($5)
86 sll $14,$3,$7
87 or $8,$11,$12
88 sw $8,4($4)
89 srl $9,$10,$13
91 addiu $5,$5,-16
92 or $8,$14,$9
93 bgtz $6,.Loop
94 sw $8,0($4)
96 .Lend: sll $8,$10,$7
97 j $31
98 sw $8,-4($4)
99 EPILOGUE(mpn_lshift)