Hex Artifact Content
Not logged in

Artifact 51ff26aae29b982b77d3c9c73c4311a77f8052ba:


0000: 64 6e 6c 20 20 41 52 4d 20 6d 70 6e 5f 73 75 62  dnl  ARM mpn_sub
0010: 6d 75 6c 5f 31 20 2d 2d 20 4d 75 6c 74 69 70 6c  mul_1 -- Multipl
0020: 79 20 61 20 6c 69 6d 62 20 76 65 63 74 6f 72 20  y a limb vector 
0030: 77 69 74 68 20 61 20 6c 69 6d 62 20 61 6e 64 20  with a limb and 
0040: 73 75 62 74 72 61 63 74 20 74 68 65 0a 64 6e 6c  subtract the.dnl
0050: 20 20 72 65 73 75 6c 74 20 66 72 6f 6d 20 61 20    result from a 
0060: 73 65 63 6f 6e 64 20 6c 69 6d 62 20 76 65 63 74  second limb vect
0070: 6f 72 2e 0a 64 6e 6c 20 20 42 61 73 65 64 20 6f  or..dnl  Based o
0080: 6e 20 6d 70 6e 5f 61 64 64 6d 75 6c 5f 31 2c 20  n mpn_addmul_1, 
0090: 77 68 69 63 68 20 77 61 73 20 63 6f 6e 74 72 69  which was contri
00a0: 62 75 74 65 64 20 62 79 20 52 6f 62 65 72 74 20  buted by Robert 
00b0: 48 61 72 6c 65 79 2e 0a 0a 64 6e 6c 20 20 43 6f  Harley...dnl  Co
00c0: 70 79 72 69 67 68 74 20 31 39 39 38 2c 20 32 30  pyright 1998, 20
00d0: 30 30 2c 20 32 30 30 31 20 46 72 65 65 20 53 6f  00, 2001 Free So
00e0: 66 74 77 61 72 65 20 46 6f 75 6e 64 61 74 69 6f  ftware Foundatio
00f0: 6e 2c 20 49 6e 63 2e 0a 0a 64 6e 6c 20 20 54 68  n, Inc...dnl  Th
0100: 69 73 20 66 69 6c 65 20 69 73 20 70 61 72 74 20  is file is part 
0110: 6f 66 20 74 68 65 20 47 4e 55 20 4d 50 20 4c 69  of the GNU MP Li
0120: 62 72 61 72 79 2e 0a 0a 64 6e 6c 20 20 54 68 65  brary...dnl  The
0130: 20 47 4e 55 20 4d 50 20 4c 69 62 72 61 72 79 20   GNU MP Library 
0140: 69 73 20 66 72 65 65 20 73 6f 66 74 77 61 72 65  is free software
0150: 3b 20 79 6f 75 20 63 61 6e 20 72 65 64 69 73 74  ; you can redist
0160: 72 69 62 75 74 65 20 69 74 20 61 6e 64 2f 6f 72  ribute it and/or
0170: 20 6d 6f 64 69 66 79 0a 64 6e 6c 20 20 69 74 20   modify.dnl  it 
0180: 75 6e 64 65 72 20 74 68 65 20 74 65 72 6d 73 20  under the terms 
0190: 6f 66 20 74 68 65 20 47 4e 55 20 4c 65 73 73 65  of the GNU Lesse
01a0: 72 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63  r General Public
01b0: 20 4c 69 63 65 6e 73 65 20 61 73 20 70 75 62 6c   License as publ
01c0: 69 73 68 65 64 0a 64 6e 6c 20 20 62 79 20 74 68  ished.dnl  by th
01d0: 65 20 46 72 65 65 20 53 6f 66 74 77 61 72 65 20  e Free Software 
01e0: 46 6f 75 6e 64 61 74 69 6f 6e 3b 20 65 69 74 68  Foundation; eith
01f0: 65 72 20 76 65 72 73 69 6f 6e 20 32 2e 31 20 6f  er version 2.1 o
0200: 66 20 74 68 65 20 4c 69 63 65 6e 73 65 2c 20 6f  f the License, o
0210: 72 20 28 61 74 0a 64 6e 6c 20 20 79 6f 75 72 20  r (at.dnl  your 
0220: 6f 70 74 69 6f 6e 29 20 61 6e 79 20 6c 61 74 65  option) any late
0230: 72 20 76 65 72 73 69 6f 6e 2e 0a 0a 64 6e 6c 20  r version...dnl 
0240: 20 54 68 65 20 47 4e 55 20 4d 50 20 4c 69 62 72   The GNU MP Libr
0250: 61 72 79 20 69 73 20 64 69 73 74 72 69 62 75 74  ary is distribut
0260: 65 64 20 69 6e 20 74 68 65 20 68 6f 70 65 20 74  ed in the hope t
0270: 68 61 74 20 69 74 20 77 69 6c 6c 20 62 65 20 75  hat it will be u
0280: 73 65 66 75 6c 2c 20 62 75 74 0a 64 6e 6c 20 20  seful, but.dnl  
0290: 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 52 52  WITHOUT ANY WARR
02a0: 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 65 76  ANTY; without ev
02b0: 65 6e 20 74 68 65 20 69 6d 70 6c 69 65 64 20 77  en the implied w
02c0: 61 72 72 61 6e 74 79 20 6f 66 20 4d 45 52 43 48  arranty of MERCH
02d0: 41 4e 54 41 42 49 4c 49 54 59 0a 64 6e 6c 20 20  ANTABILITY.dnl  
02e0: 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 41  or FITNESS FOR A
02f0: 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 52 50   PARTICULAR PURP
0300: 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20 47 4e  OSE.  See the GN
0310: 55 20 4c 65 73 73 65 72 20 47 65 6e 65 72 61 6c  U Lesser General
0320: 20 50 75 62 6c 69 63 0a 64 6e 6c 20 20 4c 69 63   Public.dnl  Lic
0330: 65 6e 73 65 20 66 6f 72 20 6d 6f 72 65 20 64 65  ense for more de
0340: 74 61 69 6c 73 2e 0a 0a 64 6e 6c 20 20 59 6f 75  tails...dnl  You
0350: 20 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63   should have rec
0360: 65 69 76 65 64 20 61 20 63 6f 70 79 20 6f 66 20  eived a copy of 
0370: 74 68 65 20 47 4e 55 20 4c 65 73 73 65 72 20 47  the GNU Lesser G
0380: 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69  eneral Public Li
0390: 63 65 6e 73 65 0a 64 6e 6c 20 20 61 6c 6f 6e 67  cense.dnl  along
03a0: 20 77 69 74 68 20 74 68 65 20 47 4e 55 20 4d 50   with the GNU MP
03b0: 20 4c 69 62 72 61 72 79 3b 20 73 65 65 20 74 68   Library; see th
03c0: 65 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 2e 4c  e file COPYING.L
03d0: 49 42 2e 20 20 49 66 20 6e 6f 74 2c 20 77 72 69  IB.  If not, wri
03e0: 74 65 20 74 6f 0a 64 6e 6c 20 20 74 68 65 20 46  te to.dnl  the F
03f0: 72 65 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75  ree Software Fou
0400: 6e 64 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35  ndation, Inc., 5
0410: 39 20 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d  9 Temple Place -
0420: 20 53 75 69 74 65 20 33 33 30 2c 20 42 6f 73 74   Suite 330, Bost
0430: 6f 6e 2c 0a 64 6e 6c 20 20 4d 41 20 30 32 31 31  on,.dnl  MA 0211
0440: 31 2d 31 33 30 37 2c 20 55 53 41 2e 0a 0a 69 6e  1-1307, USA...in
0450: 63 6c 75 64 65 28 60 2e 2e 2f 63 6f 6e 66 69 67  clude(`../config
0460: 2e 6d 34 27 29 0a 0a 43 20 54 68 69 73 20 72 75  .m4')..C This ru
0470: 6e 73 20 61 74 20 39 2e 37 35 20 63 79 63 6c 65  ns at 9.75 cycle
0480: 73 2f 6c 69 6d 62 20 69 6e 20 74 68 65 20 53 74  s/limb in the St
0490: 72 6f 6e 67 41 52 4d 2e 0a 0a 43 20 43 6f 75 6c  rongARM...C Coul
04a0: 64 20 75 73 65 20 73 6f 6d 65 20 72 65 67 69 73  d use some regis
04b0: 74 65 72 20 63 6c 65 61 6e 75 70 2e 20 20 53 6f  ter cleanup.  So
04c0: 6d 65 20 66 65 77 65 72 20 72 65 67 69 73 74 65  me fewer registe
04d0: 72 73 20 6d 69 67 68 74 20 62 65 20 6e 65 65 64  rs might be need
04e0: 65 64 2c 20 6f 72 0a 43 20 72 31 31 20 63 6f 75  ed, or.C r11 cou
04f0: 6c 64 20 62 65 20 75 74 69 6c 69 7a 65 64 20 66  ld be utilized f
0500: 6f 72 20 62 65 74 74 65 72 20 73 70 65 65 64 2e  or better speed.
0510: 20 20 43 6f 75 6c 64 20 61 76 6f 69 64 20 73 61    Could avoid sa
0520: 76 69 6e 67 20 61 6c 6c 20 72 65 67 69 73 74 65  ving all registe
0530: 72 73 20 66 6f 72 0a 43 20 73 6d 61 6c 6c 20 28  rs for.C small (
0540: 6e 20 3c 3d 20 33 29 20 6f 70 65 72 61 6e 64 73  n <= 3) operands
0550: 2e 0a 0a 64 65 66 69 6e 65 28 60 72 70 27 2c 60  ...define(`rp',`
0560: 72 30 27 29 0a 64 65 66 69 6e 65 28 60 75 70 27  r0').define(`up'
0570: 2c 60 72 31 27 29 0a 64 65 66 69 6e 65 28 60 6e  ,`r1').define(`n
0580: 27 2c 60 72 32 27 29 0a 64 65 66 69 6e 65 28 60  ',`r2').define(`
0590: 76 27 2c 60 72 33 27 29 0a 0a 41 53 4d 5f 53 54  v',`r3')..ASM_ST
05a0: 41 52 54 28 29 0a 50 52 4f 4c 4f 47 55 45 28 6d  ART().PROLOGUE(m
05b0: 70 6e 5f 73 75 62 6d 75 6c 5f 31 29 0a 09 73 74  pn_submul_1)..st
05c0: 6d 66 64 09 73 70 21 2c 20 7b 20 72 34 2d 72 31  mfd.sp!, { r4-r1
05d0: 30 2c 20 6c 72 20 7d 0a 09 6d 6f 76 09 72 34 2c  0, lr }..mov.r4,
05e0: 20 23 30 0a 09 6d 6f 76 73 09 6e 2c 20 6e 2c 20   #0..movs.n, n, 
05f0: 6c 73 72 20 23 31 0a 09 62 63 63 09 4c 28 73 6b  lsr #1..bcc.L(sk
0600: 69 70 31 29 0a 09 6c 64 72 09 6c 72 2c 20 5b 75  ip1)..ldr.lr, [u
0610: 70 5d 2c 20 23 34 0a 09 75 6d 75 6c 6c 09 72 34  p], #4..umull.r4
0620: 2c 20 72 31 32 2c 20 76 2c 20 6c 72 0a 09 6c 64  , r12, v, lr..ld
0630: 72 09 72 36 2c 20 5b 72 70 5d 0a 09 73 75 62 73  r.r6, [rp]..subs
0640: 09 72 36 2c 20 72 36 2c 20 72 34 0a 09 73 62 63  .r6, r6, r4..sbc
0650: 09 72 34 2c 20 72 30 2c 20 72 30 0a 09 73 75 62  .r4, r0, r0..sub
0660: 09 72 34 2c 20 72 31 32 2c 20 72 34 0a 09 73 74  .r4, r12, r4..st
0670: 72 09 72 36 2c 20 5b 72 70 5d 2c 20 23 34 0a 4c  r.r6, [rp], #4.L
0680: 28 73 6b 69 70 31 29 3a 0a 09 6d 6f 76 73 09 6e  (skip1):..movs.n
0690: 2c 20 6e 2c 20 6c 73 72 20 23 31 0a 09 62 63 63  , n, lsr #1..bcc
06a0: 09 4c 28 73 6b 69 70 32 29 0a 09 6c 64 6d 69 61  .L(skip2)..ldmia
06b0: 09 75 70 21 2c 20 7b 20 72 39 2c 20 72 31 30 20  .up!, { r9, r10 
06c0: 7d 0a 09 6d 6f 76 09 72 35 2c 20 23 30 0a 09 75  }..mov.r5, #0..u
06d0: 6d 6c 61 6c 09 72 34 2c 20 72 35 2c 20 76 2c 20  mlal.r4, r5, v, 
06e0: 72 39 0a 09 6d 6f 76 09 72 39 2c 20 23 30 0a 09  r9..mov.r9, #0..
06f0: 75 6d 6c 61 6c 09 72 35 2c 20 72 39 2c 20 76 2c  umlal.r5, r9, v,
0700: 20 72 31 30 0a 09 6c 64 6d 69 61 09 72 70 2c 20   r10..ldmia.rp, 
0710: 7b 20 72 36 2c 20 72 37 20 7d 0a 09 73 75 62 73  { r6, r7 }..subs
0720: 09 72 36 2c 20 72 36 2c 20 72 34 0a 09 73 62 63  .r6, r6, r4..sbc
0730: 73 09 72 37 2c 20 72 37 2c 20 72 35 0a 09 73 62  s.r7, r7, r5..sb
0740: 63 09 72 34 2c 20 72 30 2c 20 72 30 0a 09 73 75  c.r4, r0, r0..su
0750: 62 09 72 34 2c 20 72 39 2c 20 72 34 0a 09 73 74  b.r4, r9, r4..st
0760: 6d 69 61 09 72 70 21 2c 20 7b 20 72 36 2c 20 72  mia.rp!, { r6, r
0770: 37 20 7d 0a 4c 28 73 6b 69 70 32 29 3a 0a 09 74  7 }.L(skip2):..t
0780: 65 71 09 6e 2c 20 23 30 0a 09 62 65 71 09 4c 28  eq.n, #0..beq.L(
0790: 72 65 74 75 72 6e 29 0a 0a 4c 28 73 75 62 6d 75  return)..L(submu
07a0: 6c 5f 6c 6f 6f 70 29 3a 0a 09 6c 64 6d 69 61 09  l_loop):..ldmia.
07b0: 75 70 21 2c 20 7b 20 72 39 2c 20 72 31 30 2c 20  up!, { r9, r10, 
07c0: 72 31 32 2c 20 6c 72 20 7d 0a 09 6d 6f 76 09 72  r12, lr }..mov.r
07d0: 35 2c 20 23 30 0a 09 75 6d 6c 61 6c 09 72 34 2c  5, #0..umlal.r4,
07e0: 20 72 35 2c 20 76 2c 20 72 39 0a 09 6d 6f 76 09   r5, v, r9..mov.
07f0: 72 39 2c 20 23 30 0a 09 75 6d 6c 61 6c 09 72 35  r9, #0..umlal.r5
0800: 2c 20 72 39 2c 20 76 2c 20 72 31 30 0a 09 6d 6f  , r9, v, r10..mo
0810: 76 09 72 31 30 2c 20 23 30 0a 09 75 6d 6c 61 6c  v.r10, #0..umlal
0820: 09 72 39 2c 20 72 31 30 2c 20 76 2c 20 72 31 32  .r9, r10, v, r12
0830: 0a 09 6d 6f 76 09 72 31 32 2c 20 23 30 0a 09 75  ..mov.r12, #0..u
0840: 6d 6c 61 6c 09 72 31 30 2c 20 72 31 32 2c 20 76  mlal.r10, r12, v
0850: 2c 20 6c 72 0a 09 6c 64 6d 69 61 09 72 70 2c 20  , lr..ldmia.rp, 
0860: 7b 20 72 36 2c 20 72 37 2c 20 72 38 2c 20 6c 72  { r6, r7, r8, lr
0870: 20 7d 0a 09 73 75 62 73 09 72 36 2c 20 72 36 2c   }..subs.r6, r6,
0880: 20 72 34 0a 09 73 62 63 73 09 72 37 2c 20 72 37   r4..sbcs.r7, r7
0890: 2c 20 72 35 0a 09 73 62 63 73 09 72 38 2c 20 72  , r5..sbcs.r8, r
08a0: 38 2c 20 72 39 0a 09 73 62 63 73 09 6c 72 2c 20  8, r9..sbcs.lr, 
08b0: 6c 72 2c 20 72 31 30 0a 09 73 62 63 09 72 34 2c  lr, r10..sbc.r4,
08c0: 20 72 30 2c 20 72 30 0a 09 73 75 62 09 72 34 2c   r0, r0..sub.r4,
08d0: 20 72 31 32 2c 20 72 34 0a 09 73 75 62 73 09 6e   r12, r4..subs.n
08e0: 2c 20 6e 2c 20 23 31 0a 09 73 74 6d 69 61 09 72  , n, #1..stmia.r
08f0: 70 21 2c 20 7b 20 72 36 2c 20 72 37 2c 20 72 38  p!, { r6, r7, r8
0900: 2c 20 6c 72 20 7d 0a 09 62 6e 65 09 4c 28 73 75  , lr }..bne.L(su
0910: 62 6d 75 6c 5f 6c 6f 6f 70 29 0a 4c 28 72 65 74  bmul_loop).L(ret
0920: 75 72 6e 29 3a 0a 09 6d 6f 76 09 72 30 2c 20 72  urn):..mov.r0, r
0930: 34 0a 09 6c 64 6d 66 64 09 73 70 21 2c 20 7b 20  4..ldmfd.sp!, { 
0940: 72 34 2d 72 31 30 2c 20 70 63 20 7d 0a 45 50 49  r4-r10, pc }.EPI
0950: 4c 4f 47 55 45 28 6d 70 6e 5f 73 75 62 6d 75 6c  LOGUE(mpn_submul
0960: 5f 31 29 0a                                      _1).