(+cflags): Append to this instead of CFLAGS.
[glibc.git] / sysdeps / mips / submul_1.s
blob616dd1b47ce945276c14b5a75e3798bc94ed1e7d
1 # MIPS __mpn_submul_1 -- Multiply a limb vector with a single limb and
2 # subtract the product from 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_submul_1
32 .ent __mpn_submul_1
33 __mpn_submul_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: lw $10,0($4)
53 mflo $3
54 mfhi $9
55 addiu $5,$5,4
56 addu $3,$3,$2 # add old carry limb to low product limb
57 multu $8,$7
58 lw $8,0($5) # load new s1 limb as early as possible
59 addiu $6,$6,-1 # decrement loop counter
60 sltu $2,$3,$2 # carry from previous addition -> $2
61 subu $3,$10,$3
62 sgtu $10,$3,$10
63 addu $2,$2,$10
64 sw $3,0($4)
65 addiu $4,$4,4
66 bne $6,$0,Loop # should be "bnel"
67 addu $2,$9,$2 # add high product limb and carry from addition
69 # cool down phase 1
70 $LC1: lw $10,0($4)
71 mflo $3
72 mfhi $9
73 addu $3,$3,$2
74 sltu $2,$3,$2
75 multu $8,$7
76 subu $3,$10,$3
77 sgtu $10,$3,$10
78 addu $2,$2,$10
79 sw $3,0($4)
80 addiu $4,$4,4
81 addu $2,$9,$2 # add high product limb and carry from addition
83 # cool down phase 0
84 $LC0: lw $10,0($4)
85 mflo $3
86 mfhi $9
87 addu $3,$3,$2
88 sltu $2,$3,$2
89 subu $3,$10,$3
90 sgtu $10,$3,$10
91 addu $2,$2,$10
92 sw $3,0($4)
93 j $31
94 addu $2,$9,$2 # add high product limb and carry from addition
96 .end __mpn_submul_1