(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / mips / mips64 / addmul_1.S
blobf5ecd83702df8f47f4c67ff88123e69cfaf364ee
1 /* MIPS3 __mpn_addmul_1 -- Multiply a limb vector with a single limb and
2  * add the product to a second limb vector.
3  *
4  * Copyright (C) 1992, 1994, 1995, 2002, 2003 Free Software Foundation, Inc.
5  *
6  * This file is part of the GNU MP Library.
7  *
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.
12  *
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.
17  *
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.
22  */
24 #include <sysdep.h>
25 #include <sys/asm.h>
27 /* INPUT PARAMETERS
28  * res_ptr      $4
29  * s1_ptr       $5
30  * size         $6
31  * s2_limb      $7
32  */
34 #ifdef PIC
35         .option pic2
36 #endif
37         .text
38         .align  4
39         .globl  __mpn_addmul_1
40         .ent    __mpn_addmul_1
41 __mpn_addmul_1:
42 #ifdef PIC
43         SETUP_GP /* ??? unused */
44 #endif
45         .set    noreorder
46         .set    nomacro
48  # warm up phase 0
49         ld      $8,0($5)
51  # warm up phase 1
52         daddiu  $5,$5,8
53         dmultu  $8,$7
55         daddiu  $6,$6,-1
56         beq     $6,$0,L(LC0)
57         move    $2,$0           # zero cy2
59         daddiu  $6,$6,-1
60         beq     $6,$0,L(LC1)
61         ld      $8,0($5)        # load new s1 limb as early as possible
63 L(Loop):        ld      $10,0($4)
64         mflo    $3
65         mfhi    $9
66         daddiu  $5,$5,8
67         daddu   $3,$3,$2        # add old carry limb to low product limb
68         dmultu  $8,$7
69         ld      $8,0($5)        # load new s1 limb as early as possible
70         daddiu  $6,$6,-1        # decrement loop counter
71         sltu    $2,$3,$2        # carry from previous addition -> $2
72         daddu   $3,$10,$3
73         sltu    $10,$3,$10
74         daddu   $2,$2,$10
75         sd      $3,0($4)
76         daddiu  $4,$4,8
77         bne     $6,$0,L(Loop)
78         daddu   $2,$9,$2        # add high product limb and carry from addition
80  # cool down phase 1
81 L(LC1): ld      $10,0($4)
82         mflo    $3
83         mfhi    $9
84         daddu   $3,$3,$2
85         sltu    $2,$3,$2
86         dmultu  $8,$7
87         daddu   $3,$10,$3
88         sltu    $10,$3,$10
89         daddu   $2,$2,$10
90         sd      $3,0($4)
91         daddiu  $4,$4,8
92         daddu   $2,$9,$2        # add high product limb and carry from addition
94  # cool down phase 0
95 L(LC0): ld      $10,0($4)
96         mflo    $3
97         mfhi    $9
98         daddu   $3,$3,$2
99         sltu    $2,$3,$2
100         daddu   $3,$10,$3
101         sltu    $10,$3,$10
102         daddu   $2,$2,$10
103         sd      $3,0($4)
104         j       $31
105         daddu   $2,$9,$2        # add high product limb and carry from addition
107         .end    __mpn_addmul_1