(+cflags): Append to this instead of CFLAGS.
[glibc.git] / sysdeps / mips / mul_1.s
blob01327e22d8da3af14a31e5c0863dabafa1bd2c3b
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) 1992, 1994 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 Library General Public License as published by
10 # the Free Software Foundation; either version 2 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 Library General Public
16 # License for more details.
18 # You should have received a copy of the GNU Library 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., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # INPUT PARAMETERS
24 # res_ptr $4
25 # s1_ptr $5
26 # size $6
27 # s2_limb $7
29 .text
30 .align 4
31 .globl __mpn_mul_1
32 .ent __mpn_mul_1
33 __mpn_mul_1:
34 .set noreorder
35 .set nomacro
37 # warm up phase 0
38 lw $8,0($5)
40 # warm up phase 1
41 addiu $5,$5,4
42 multu $8,$7
44 addiu $6,$6,-1
45 beq $6,$0,$LC0
46 move $2,$0 # zero cy2
48 addiu $6,$6,-1
49 beq $6,$0,$LC1
50 lw $8,0($5) # load new s1 limb as early as possible
52 Loop: mflo $10
53 mfhi $9
54 addiu $5,$5,4
55 addu $10,$10,$2 # add old carry limb to low product limb
56 multu $8,$7
57 lw $8,0($5) # load new s1 limb as early as possible
58 addiu $6,$6,-1 # decrement loop counter
59 sltu $2,$10,$2 # carry from previous addition -> $2
60 sw $10,0($4)
61 addiu $4,$4,4
62 bne $6,$0,Loop # should be "bnel"
63 addu $2,$9,$2 # add high product limb and carry from addition
65 # cool down phase 1
66 $LC1: mflo $10
67 mfhi $9
68 addu $10,$10,$2
69 sltu $2,$10,$2
70 multu $8,$7
71 sw $10,0($4)
72 addiu $4,$4,4
73 addu $2,$9,$2 # add high product limb and carry from addition
75 # cool down phase 0
76 $LC0: mflo $10
77 mfhi $9
78 addu $10,$10,$2
79 sltu $2,$10,$2
80 sw $10,0($4)
81 j $31
82 addu $2,$9,$2 # add high product limb and carry from addition
84 .end __mpn_mul_1