(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / mips / sub_n.S
blob53fa0193438bced62d5650b24a063cc3fc3377c6
1 /* MIPS2 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2 store difference in a third limb vector.
4 Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
6 This file is part of the GNU MP Library.
8 The GNU MP Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or (at your
11 option) any later version.
13 The GNU MP Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA.  */
23 #include <sysdep.h>
25 /* INPUT PARAMETERS
26    res_ptr      $4
27    s1_ptr       $5
28    s2_ptr       $6
29    size         $7
31 #ifdef __PIC__
32         .option pic2
33 #endif
34 ENTRY (__mpn_sub_n)
35         .set    noreorder
36 #ifdef __PIC__
37         .cpload t9
38 #endif
39         .set    nomacro
41         lw      $10,0($5)
42         lw      $11,0($6)
44         addiu   $7,$7,-1
45         and     $9,$7,4-1       /* number of limbs in first loop */
46         beq     $9,$0,L(L0)     /* if multiple of 4 limbs, skip first loop */
47         move    $2,$0
49         subu    $7,$7,$9
51 L(Loop0):       addiu   $9,$9,-1
52         lw      $12,4($5)
53         addu    $11,$11,$2
54         lw      $13,4($6)
55         sltu    $8,$11,$2
56         subu    $11,$10,$11
57         sltu    $2,$10,$11
58         sw      $11,0($4)
59         or      $2,$2,$8
61         addiu   $5,$5,4
62         addiu   $6,$6,4
63         move    $10,$12
64         move    $11,$13
65         bne     $9,$0,L(Loop0)
66         addiu   $4,$4,4
68 L(L0):  beq     $7,$0,L(Lend)
69         nop
71 L(Loop):        addiu   $7,$7,-4
73         lw      $12,4($5)
74         addu    $11,$11,$2
75         lw      $13,4($6)
76         sltu    $8,$11,$2
77         subu    $11,$10,$11
78         sltu    $2,$10,$11
79         sw      $11,0($4)
80         or      $2,$2,$8
82         lw      $10,8($5)
83         addu    $13,$13,$2
84         lw      $11,8($6)
85         sltu    $8,$13,$2
86         subu    $13,$12,$13
87         sltu    $2,$12,$13
88         sw      $13,4($4)
89         or      $2,$2,$8
91         lw      $12,12($5)
92         addu    $11,$11,$2
93         lw      $13,12($6)
94         sltu    $8,$11,$2
95         subu    $11,$10,$11
96         sltu    $2,$10,$11
97         sw      $11,8($4)
98         or      $2,$2,$8
100         lw      $10,16($5)
101         addu    $13,$13,$2
102         lw      $11,16($6)
103         sltu    $8,$13,$2
104         subu    $13,$12,$13
105         sltu    $2,$12,$13
106         sw      $13,12($4)
107         or      $2,$2,$8
109         addiu   $5,$5,16
110         addiu   $6,$6,16
112         bne     $7,$0,L(Loop)
113         addiu   $4,$4,16
115 L(Lend):        addu    $11,$11,$2
116         sltu    $8,$11,$2
117         subu    $11,$10,$11
118         sltu    $2,$10,$11
119         sw      $11,0($4)
120         j       $31
121         or      $2,$2,$8
122         END (__mpn_sub_n)