support_become_root: Enable file creation in user namespaces
[glibc.git] / sysdeps / mips / mul_1.S
blobd924f020611132ebbcc89e190813cce352f23d20
1 /* MIPS __mpn_mul_1 -- Multiply a limb vector with a single limb and
2 store the product in a second limb vector.
4 Copyright (C) 1995-2017 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.  If not, see
20 <http://www.gnu.org/licenses/>.  */
22 #include <sysdep.h>
24 /* INPUT PARAMETERS
25    res_ptr      $4
26    s1_ptr       $5
27    size         $6
28    s2_limb      $7
30 #ifdef __PIC__
31         .option pic2
32 #endif
33 ENTRY (__mpn_mul_1)
34         .set    noreorder
35 #ifdef __PIC__
36         .cpload t9
37 #endif
38         .set    nomacro
40         /* warm up phase 0 */
41         lw      $8,0($5)
43         /* warm up phase 1 */
44         addiu   $5,$5,4
45 #if __mips_isa_rev < 6
46         multu   $8,$7
47 #else
48         mulu    $11,$8,$7
49         muhu    $12,$8,$7
50 #endif
52         addiu   $6,$6,-1
53         beq     $6,$0,L(LC0)
54         move    $2,$0           /* zero cy2 */
56         addiu   $6,$6,-1
57         beq     $6,$0,L(LC1)
58         lw      $8,0($5)        /* load new s1 limb as early as possible */
61 #if  __mips_isa_rev < 6
62 L(Loop):        mflo    $10
63         mfhi    $9
64 #else
65 L(Loop):        move    $10,$11
66         move    $9,$12
67 #endif
68         addiu   $5,$5,4
69         addu    $10,$10,$2      /* add old carry limb to low product limb */
70 #if __mips_isa_rev < 6
71         multu   $8,$7
72 #else
73         mulu    $11,$8,$7
74         muhu    $12,$8,$7
75 #endif
76         lw      $8,0($5)        /* load new s1 limb as early as possible */
77         addiu   $6,$6,-1        /* decrement loop counter */
78         sltu    $2,$10,$2       /* carry from previous addition -> $2 */
79         sw      $10,0($4)
80         addiu   $4,$4,4
81         bne     $6,$0,L(Loop)   /* should be "bnel" */
82         addu    $2,$9,$2        /* add high product limb and carry from addition */
84         /* cool down phase 1 */
85 #if __mips_isa_rev < 6
86 L(LC1): mflo    $10
87         mfhi    $9
88 #else
89 L(LC1): move    $10,$11
90         move    $9,$12
91 #endif
92         addu    $10,$10,$2
93         sltu    $2,$10,$2
94 #if __mips_isa_rev < 6
95         multu   $8,$7
96 #else
97         mulu    $11,$8,$7
98         muhu    $12,$8,$7
99 #endif
100         sw      $10,0($4)
101         addiu   $4,$4,4
102         addu    $2,$9,$2        /* add high product limb and carry from addition */
104         /* cool down phase 0 */
105 #if __mips_isa_rev < 6
106 L(LC0): mflo    $10
107         mfhi    $9
108 #else
109 L(LC0): move    $10,$11
110         move    $9,$12
111 #endif
112         addu    $10,$10,$2
113         sltu    $2,$10,$2
114         sw      $10,0($4)
115         j       $31
116         addu    $2,$9,$2        /* add high product limb and carry from addition */
117         END (__mpn_mul_1)