beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / mips64 / lshift.asm
blob3440eaf80b5b62200f602d11b70434f1d8124ca8
1 dnl MIPS64 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 dsll $2,$6,3
42 daddu $5,$5,$2 C make r5 point at end of src
43 ld $10,-8($5) C load first limb
44 dsubu $13,$0,$7
45 daddu $4,$4,$2 C make r4 point at end of res
46 daddiu $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 dsrl $2,$10,$13 C compute function result
51 dsubu $6,$6,$9
53 .Loop0: ld $3,-16($5)
54 daddiu $4,$4,-8
55 daddiu $5,$5,-8
56 daddiu $9,$9,-1
57 dsll $11,$10,$7
58 dsrl $12,$3,$13
59 move $10,$3
60 or $8,$11,$12
61 bne $9,$0,.Loop0
62 sd $8,0($4)
64 .L0: beq $6,$0,.Lend
65 nop
67 .Loop: ld $3,-16($5)
68 daddiu $4,$4,-32
69 daddiu $6,$6,-4
70 dsll $11,$10,$7
71 dsrl $12,$3,$13
73 ld $10,-24($5)
74 dsll $14,$3,$7
75 or $8,$11,$12
76 sd $8,24($4)
77 dsrl $9,$10,$13
79 ld $3,-32($5)
80 dsll $11,$10,$7
81 or $8,$14,$9
82 sd $8,16($4)
83 dsrl $12,$3,$13
85 ld $10,-40($5)
86 dsll $14,$3,$7
87 or $8,$11,$12
88 sd $8,8($4)
89 dsrl $9,$10,$13
91 daddiu $5,$5,-32
92 or $8,$14,$9
93 bgtz $6,.Loop
94 sd $8,0($4)
96 .Lend: dsll $8,$10,$7
97 j $31
98 sd $8,-8($4)
99 EPILOGUE(mpn_lshift)