2 # Alpha 21064 __mpn_submul_1 -- Multiply a limb vector with a limb and
3 # subtract the result from a second limb vector.
5 # Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
7 # This file is part of the GNU MP Library.
9 # The GNU MP Library is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU Library General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or (at your
12 # option) any later version.
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 Library General Public
17 # License for more details.
19 # You should have received a copy of the GNU Library General Public License
20 # along with the GNU MP Library; see the file COPYING.LIB. If not, write to
21 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
31 # This code runs at 42 cycles/limb on EV4 and 18 cycles/limb on EV5.
43 ldq $2,0($17) # $2 = s1_limb
44 addq $17,8,$17 # s1_ptr++
45 subq $18,1,$18 # size--
46 mulq $2,$19,$3 # $3 = prod_low
47 ldq $5,0($16) # $5 = *res_ptr
48 umulh $2,$19,$0 # $0 = prod_high
49 beq $18,.Lend1 # jump if size was == 1
50 ldq $2,0($17) # $2 = s1_limb
51 addq $17,8,$17 # s1_ptr++
52 subq $18,1,$18 # size--
56 addq $16,8,$16 # res_ptr++
57 beq $18,.Lend2 # jump if size was == 2
60 .Loop: mulq $2,$19,$3 # $3 = prod_low
61 ldq $5,0($16) # $5 = *res_ptr
62 addq $4,$0,$0 # cy_limb = cy_limb + 'cy'
63 subq $18,1,$18 # size--
64 umulh $2,$19,$4 # $4 = cy_limb
65 ldq $2,0($17) # $2 = s1_limb
66 addq $17,8,$17 # s1_ptr++
67 addq $3,$0,$3 # $3 = cy_limb + prod_low
68 cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low)
72 addq $16,8,$16 # res_ptr++
73 addq $5,$0,$0 # combine carries
76 .Lend2: mulq $2,$19,$3 # $3 = prod_low
77 ldq $5,0($16) # $5 = *res_ptr
78 addq $4,$0,$0 # cy_limb = cy_limb + 'cy'
79 umulh $2,$19,$4 # $4 = cy_limb
80 addq $3,$0,$3 # $3 = cy_limb + prod_low
81 cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low)
85 addq $5,$0,$0 # combine carries
86 addq $4,$0,$0 # cy_limb = prod_high + cy