(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / mips / mips64 / rshift.S
blobe6a8a06d3d73137967fccaab9bb79a9cf0f94f56
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; 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  */
23 #include <sysdep.h>
24 #include <sys/asm.h>
26 /* INPUT PARAMETERS
27  * res_ptr      $4
28  * src_ptr      $5
29  * size         $6
30  * cnt          $7
31  */
33 #ifdef __PIC__
34         .option pic2
35 #endif
36         .text
37         .align  2
38         .globl  __mpn_rshift
39         .ent    __mpn_rshift
40 __mpn_rshift:
41 #ifdef __PIC__
42         SETUP_GP /* ??? unused */
43 #endif
44         .set    noreorder
45         .set    nomacro
47         ld      $10,0($5)       # load first limb
48         dsubu   $13,$0,$7
49         daddiu  $6,$6,-1
50         and     $9,$6,4-1       # number of limbs in first loop
51         beq     $9,$0,L(L0)     # if multiple of 4 limbs, skip first loop
52         dsll    $2,$10,$13      # compute function result
54         dsubu   $6,$6,$9
56 L(Loop0):       ld      $3,8($5)
57         daddiu  $4,$4,8
58         daddiu  $5,$5,8
59         daddiu  $9,$9,-1
60         dsrl    $11,$10,$7
61         dsll    $12,$3,$13
62         move    $10,$3
63         or      $8,$11,$12
64         bne     $9,$0,L(Loop0)
65         sd      $8,-8($4)
67 L(L0):  beq     $6,$0,L(Lend)
68         nop
70 L(Loop):        ld      $3,8($5)
71         daddiu  $4,$4,32
72         daddiu  $6,$6,-4
73         dsrl    $11,$10,$7
74         dsll    $12,$3,$13
76         ld      $10,16($5)
77         dsrl    $14,$3,$7
78         or      $8,$11,$12
79         sd      $8,-32($4)
80         dsll    $9,$10,$13
82         ld      $3,24($5)
83         dsrl    $11,$10,$7
84         or      $8,$14,$9
85         sd      $8,-24($4)
86         dsll    $12,$3,$13
88         ld      $10,32($5)
89         dsrl    $14,$3,$7
90         or      $8,$11,$12
91         sd      $8,-16($4)
92         dsll    $9,$10,$13
94         daddiu  $5,$5,32
95         or      $8,$14,$9
96         bgtz    $6,L(Loop)
97         sd      $8,-8($4)
99 L(Lend):        dsrl    $8,$10,$7
100         j       $31
101         sd      $8,0($4)
102         .end    __mpn_rshift