]>
Commit | Line | Data |
---|---|---|
5107cf1d UD |
1 | /* MIPS3 __mpn_lshift -- |
2 | * | |
5ac4c397 | 3 | * Copyright (C) 1995, 2000 Free Software Foundation, Inc. |
5107cf1d UD |
4 | * |
5 | * This file is part of the GNU MP Library. | |
6 | * | |
7 | * The GNU MP Library is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU Library General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or (at your | |
10 | * option) any later version. | |
11 | * | |
12 | * The GNU MP Library is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | |
15 | * License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU Library General Public License | |
18 | * along with the GNU MP Library; see the file COPYING.LIB. If not, write to | |
19 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
20 | * MA 02111-1307, USA. | |
21 | */ | |
22 | ||
23 | #include <sysdep.h> | |
24 | ||
25 | /* INPUT PARAMETERS | |
26 | * res_ptr $4 | |
27 | * src_ptr $5 | |
28 | * size $6 | |
29 | * cnt $7 | |
30 | */ | |
31 | ||
5ac4c397 | 32 | #ifdef __PIC__ |
5107cf1d UD |
33 | .option pic2 |
34 | #endif | |
35 | .text | |
36 | .align 2 | |
37 | .globl __mpn_lshift | |
38 | .ent __mpn_lshift | |
39 | __mpn_lshift: | |
40 | .set noreorder | |
5ac4c397 | 41 | #ifdef __PIC__ |
5107cf1d UD |
42 | .cpload t9 |
43 | #endif | |
44 | .set nomacro | |
45 | ||
46 | dsll $2,$6,3 | |
47 | daddu $5,$5,$2 # make r5 point at end of src | |
48 | ld $10,-8($5) # load first limb | |
49 | dsubu $13,$0,$7 | |
50 | daddu $4,$4,$2 # make r4 point at end of res | |
51 | daddiu $6,$6,-1 | |
52 | and $9,$6,4-1 # number of limbs in first loop | |
53 | beq $9,$0,.L0 # if multiple of 4 limbs, skip first loop | |
54 | dsrl $2,$10,$13 # compute function result | |
55 | ||
56 | dsubu $6,$6,$9 | |
57 | ||
58 | .Loop0: ld $3,-16($5) | |
59 | daddiu $4,$4,-8 | |
60 | daddiu $5,$5,-8 | |
61 | daddiu $9,$9,-1 | |
62 | dsll $11,$10,$7 | |
63 | dsrl $12,$3,$13 | |
64 | move $10,$3 | |
65 | or $8,$11,$12 | |
66 | bne $9,$0,.Loop0 | |
67 | sd $8,0($4) | |
68 | ||
69 | .L0: beq $6,$0,.Lend | |
70 | nop | |
71 | ||
72 | .Loop: ld $3,-16($5) | |
73 | daddiu $4,$4,-32 | |
74 | daddiu $6,$6,-4 | |
75 | dsll $11,$10,$7 | |
76 | dsrl $12,$3,$13 | |
77 | ||
78 | ld $10,-24($5) | |
79 | dsll $14,$3,$7 | |
80 | or $8,$11,$12 | |
81 | sd $8,24($4) | |
82 | dsrl $9,$10,$13 | |
83 | ||
84 | ld $3,-32($5) | |
85 | dsll $11,$10,$7 | |
86 | or $8,$14,$9 | |
87 | sd $8,16($4) | |
88 | dsrl $12,$3,$13 | |
89 | ||
90 | ld $10,-40($5) | |
91 | dsll $14,$3,$7 | |
92 | or $8,$11,$12 | |
93 | sd $8,8($4) | |
94 | dsrl $9,$10,$13 | |
95 | ||
96 | daddiu $5,$5,-32 | |
97 | or $8,$14,$9 | |
98 | bgtz $6,.Loop | |
99 | sd $8,0($4) | |
100 | ||
101 | .Lend: dsll $8,$10,$7 | |
102 | j $31 | |
103 | sd $8,-8($4) | |
104 | .end __mpn_lshift |