Add Changelog ...
[glibc.git] / sysdeps / mips / mips64 / rshift.S
blob3cb040859d835f75088f80846d9d338440138bf0
1 /* MIPS3 __mpn_rshift --
2  *
3  * Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
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 Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 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 Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the GNU MP Library.  If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
22 #include <sysdep.h>
23 #include <sys/asm.h>
25 /* INPUT PARAMETERS
26  * res_ptr      $4
27  * src_ptr      $5
28  * size         $6
29  * cnt          $7
30  */
32 #ifdef __PIC__
33         .option pic2
34 #endif
35         .text
36         .align  2
37         .globl  __mpn_rshift
38         .ent    __mpn_rshift
39 __mpn_rshift:
40 #ifdef __PIC__
41         SETUP_GP /* ??? unused */
42 #endif
43         .set    noreorder
44         .set    nomacro
46         ld      $10,0($5)       # load first limb
47         dsubu   $13,$0,$7
48         daddiu  $6,$6,-1
49         and     $9,$6,4-1       # number of limbs in first loop
50         beq     $9,$0,L(L0)     # if multiple of 4 limbs, skip first loop
51         dsll    $2,$10,$13      # compute function result
53         dsubu   $6,$6,$9
55 L(Loop0):       ld      $3,8($5)
56         daddiu  $4,$4,8
57         daddiu  $5,$5,8
58         daddiu  $9,$9,-1
59         dsrl    $11,$10,$7
60         dsll    $12,$3,$13
61         move    $10,$3
62         or      $8,$11,$12
63         bne     $9,$0,L(Loop0)
64         sd      $8,-8($4)
66 L(L0):  beq     $6,$0,L(Lend)
67         nop
69 L(Loop):        ld      $3,8($5)
70         daddiu  $4,$4,32
71         daddiu  $6,$6,-4
72         dsrl    $11,$10,$7
73         dsll    $12,$3,$13
75         ld      $10,16($5)
76         dsrl    $14,$3,$7
77         or      $8,$11,$12
78         sd      $8,-32($4)
79         dsll    $9,$10,$13
81         ld      $3,24($5)
82         dsrl    $11,$10,$7
83         or      $8,$14,$9
84         sd      $8,-24($4)
85         dsll    $12,$3,$13
87         ld      $10,32($5)
88         dsrl    $14,$3,$7
89         or      $8,$11,$12
90         sd      $8,-16($4)
91         dsll    $9,$10,$13
93         daddiu  $5,$5,32
94         or      $8,$14,$9
95         bgtz    $6,L(Loop)
96         sd      $8,-8($4)
98 L(Lend):        dsrl    $8,$10,$7
99         j       $31
100         sd      $8,0($4)
101         .end    __mpn_rshift