1 # Alpha 21064 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
2 # the result to a second limb vector.
4 # Copyright (C) 1992-2014 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 <http://www.gnu.org/licenses/>.
28 # This code runs at 42 cycles/limb on EV4 and 18 cycles/limb on EV5.
39 ldq $2,0($17) # $2 = s1_limb
40 addq $17,8,$17 # s1_ptr++
41 subq $18,1,$18 # size--
42 mulq $2,$19,$3 # $3 = prod_low
43 ldq $5,0($16) # $5 = *res_ptr
44 umulh $2,$19,$0 # $0 = prod_high
45 beq $18,.Lend1 # jump if size was == 1
46 ldq $2,0($17) # $2 = s1_limb
47 addq $17,8,$17 # s1_ptr++
48 subq $18,1,$18 # size--
52 addq $16,8,$16 # res_ptr++
53 beq $18,.Lend2 # jump if size was == 2
56 .Loop: mulq $2,$19,$3 # $3 = prod_low
57 ldq $5,0($16) # $5 = *res_ptr
58 addq $4,$0,$0 # cy_limb = cy_limb + 'cy'
59 subq $18,1,$18 # size--
60 umulh $2,$19,$4 # $4 = cy_limb
61 ldq $2,0($17) # $2 = s1_limb
62 addq $17,8,$17 # s1_ptr++
63 addq $3,$0,$3 # $3 = cy_limb + prod_low
64 cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low)
68 addq $16,8,$16 # res_ptr++
69 addq $5,$0,$0 # combine carries
72 .Lend2: mulq $2,$19,$3 # $3 = prod_low
73 ldq $5,0($16) # $5 = *res_ptr
74 addq $4,$0,$0 # cy_limb = cy_limb + 'cy'
75 umulh $2,$19,$4 # $4 = cy_limb
76 addq $3,$0,$3 # $3 = cy_limb + prod_low
77 cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low)
81 addq $5,$0,$0 # combine carries
82 addq $4,$0,$0 # cy_limb = prod_high + cy