Update copyright notices with scripts/update-copyrights.
[glibc.git] / ports / sysdeps / mips / mips64 / submul_1.S
blob22239d52b3c8935821b892e78b92542907ee735a
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-2013 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.  If not, see
20  * <http://www.gnu.org/licenses/>.
21  */
23 #include <sysdep.h>
24 #include <sys/asm.h>
26 /* INPUT PARAMETERS
27  * res_ptr      $4
28  * s1_ptr       $5
29  * size         $6
30  * s2_limb      $7
31  */
33 #ifdef __PIC__
34         .option pic2
35 #endif
36         .text
37         .align  4
38         .globl  __mpn_submul_1
39         .ent    __mpn_submul_1
40 __mpn_submul_1:
41 #ifdef __PIC__
42         SETUP_GP /* ??? unused */
43 #endif
44         .set    noreorder
45         .set    nomacro
47  # warm up phase 0
48         ld      $8,0($5)
50  # warm up phase 1
51         daddiu  $5,$5,8
52         dmultu  $8,$7
54         daddiu  $6,$6,-1
55         beq     $6,$0,L(LC0)
56         move    $2,$0           # zero cy2
58         daddiu  $6,$6,-1
59         beq     $6,$0,L(LC1)
60         ld      $8,0($5)        # load new s1 limb as early as possible
62 L(Loop):        ld      $10,0($4)
63         mflo    $3
64         mfhi    $9
65         daddiu  $5,$5,8
66         daddu   $3,$3,$2        # add old carry limb to low product limb
67         dmultu  $8,$7
68         ld      $8,0($5)        # load new s1 limb as early as possible
69         daddiu  $6,$6,-1        # decrement loop counter
70         sltu    $2,$3,$2        # carry from previous addition -> $2
71         dsubu   $3,$10,$3
72         sgtu    $10,$3,$10
73         daddu   $2,$2,$10
74         sd      $3,0($4)
75         daddiu  $4,$4,8
76         bne     $6,$0,L(Loop)
77         daddu   $2,$9,$2        # add high product limb and carry from addition
79  # cool down phase 1
80 L(LC1): ld      $10,0($4)
81         mflo    $3
82         mfhi    $9
83         daddu   $3,$3,$2
84         sltu    $2,$3,$2
85         dmultu  $8,$7
86         dsubu   $3,$10,$3
87         sgtu    $10,$3,$10
88         daddu   $2,$2,$10
89         sd      $3,0($4)
90         daddiu  $4,$4,8
91         daddu   $2,$9,$2        # add high product limb and carry from addition
93  # cool down phase 0
94 L(LC0): ld      $10,0($4)
95         mflo    $3
96         mfhi    $9
97         daddu   $3,$3,$2
98         sltu    $2,$3,$2
99         dsubu   $3,$10,$3
100         sgtu    $10,$3,$10
101         daddu   $2,$2,$10
102         sd      $3,0($4)
103         j       $31
104         daddu   $2,$9,$2        # add high product limb and carry from addition
106         .end    __mpn_submul_1