Test for stack alignment.
[glibc.git] / sysdeps / mips / mips64 / submul_1.S
blob4971b992a1aae17c6b400fad2fed03f65187f501
1 /* MIPS3 __mpn_submul_1 -- Multiply a limb vector with a single limb and
2  * subtract the product from a second limb vector.
3  *
4  * Copyright (C) 1992, 1994, 1995, 2000, 2002, 2003
5  * Free Software Foundation, Inc.
6  *
7  * This file is part of the GNU MP Library.
8  *
9  * The GNU MP Library is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or (at your
12  * option) any later version.
13  *
14  * The GNU MP Library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
21  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22  * MA 02111-1307, USA.
23  */
25 #include <sysdep.h>
26 #include <sys/asm.h>
28 /* INPUT PARAMETERS
29  * res_ptr      $4
30  * s1_ptr       $5
31  * size         $6
32  * s2_limb      $7
33  */
35 #ifdef __PIC__
36         .option pic2
37 #endif
38         .text
39         .align  4
40         .globl  __mpn_submul_1
41         .ent    __mpn_submul_1
42 __mpn_submul_1:
43 #ifdef __PIC__
44         SETUP_GP /* ??? unused */
45 #endif
46         .set    noreorder
47         .set    nomacro
49  # warm up phase 0
50         ld      $8,0($5)
52  # warm up phase 1
53         daddiu  $5,$5,8
54         dmultu  $8,$7
56         daddiu  $6,$6,-1
57         beq     $6,$0,L(LC0)
58         move    $2,$0           # zero cy2
60         daddiu  $6,$6,-1
61         beq     $6,$0,L(LC1)
62         ld      $8,0($5)        # load new s1 limb as early as possible
64 L(Loop):        ld      $10,0($4)
65         mflo    $3
66         mfhi    $9
67         daddiu  $5,$5,8
68         daddu   $3,$3,$2        # add old carry limb to low product limb
69         dmultu  $8,$7
70         ld      $8,0($5)        # load new s1 limb as early as possible
71         daddiu  $6,$6,-1        # decrement loop counter
72         sltu    $2,$3,$2        # carry from previous addition -> $2
73         dsubu   $3,$10,$3
74         sgtu    $10,$3,$10
75         daddu   $2,$2,$10
76         sd      $3,0($4)
77         daddiu  $4,$4,8
78         bne     $6,$0,L(Loop)
79         daddu   $2,$9,$2        # add high product limb and carry from addition
81  # cool down phase 1
82 L(LC1): ld      $10,0($4)
83         mflo    $3
84         mfhi    $9
85         daddu   $3,$3,$2
86         sltu    $2,$3,$2
87         dmultu  $8,$7
88         dsubu   $3,$10,$3
89         sgtu    $10,$3,$10
90         daddu   $2,$2,$10
91         sd      $3,0($4)
92         daddiu  $4,$4,8
93         daddu   $2,$9,$2        # add high product limb and carry from addition
95  # cool down phase 0
96 L(LC0): ld      $10,0($4)
97         mflo    $3
98         mfhi    $9
99         daddu   $3,$3,$2
100         sltu    $2,$3,$2
101         dsubu   $3,$10,$3
102         sgtu    $10,$3,$10
103         daddu   $2,$2,$10
104         sd      $3,0($4)
105         j       $31
106         daddu   $2,$9,$2        # add high product limb and carry from addition
108         .end    __mpn_submul_1