arm: Pass hwcap to ifuncs.
[glibc-ports.git] / sysdeps / mips / mips64 / mul_1.S
blob8539a87b7de387cd51f205cf84617d7773e273c1
1 /* MIPS3 __mpn_mul_1 -- Multiply a limb vector with a single limb and
2  * store the product in 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.  If not, see
21  * <http://www.gnu.org/licenses/>.
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_mul_1
40         .ent    __mpn_mul_1
41 __mpn_mul_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):        mflo    $10
64         mfhi    $9
65         daddiu  $5,$5,8
66         daddu   $10,$10,$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,$10,$2       # carry from previous addition -> $2
71         sd      $10,0($4)
72         daddiu  $4,$4,8
73         bne     $6,$0,L(Loop)
74         daddu   $2,$9,$2        # add high product limb and carry from addition
76  # cool down phase 1
77 L(LC1): mflo    $10
78         mfhi    $9
79         daddu   $10,$10,$2
80         sltu    $2,$10,$2
81         dmultu  $8,$7
82         sd      $10,0($4)
83         daddiu  $4,$4,8
84         daddu   $2,$9,$2        # add high product limb and carry from addition
86  # cool down phase 0
87 L(LC0): mflo    $10
88         mfhi    $9
89         daddu   $10,$10,$2
90         sltu    $2,$10,$2
91         sd      $10,0($4)
92         j       $31
93         daddu   $2,$9,$2        # add high product limb and carry from addition
95         .end    __mpn_mul_1